Add kit firmware modifications

This commit is contained in:
Just Call Me Koko
2021-07-08 18:44:47 -04:00
parent f801ba0bc5
commit a23e7a4c48
8 changed files with 42 additions and 1 deletions

View File

@@ -2,6 +2,18 @@
bool SDInterface::initSD() {
String display_string = "";
#ifdef KIT
pinMode(SD_DET, INPUT);
if (digitalRead(SD_DET) == LOW) {
Serial.println(F("SD Card Detect Pin Detected"));
}
else {
Serial.println(F("SD Card Detect Pin Not Detected"));
this->supported = false;
return false;
}
#endif
if (!SD.begin(SD_CS)) {
Serial.println(F("Failed to mount SD Card"));
@@ -167,11 +179,28 @@ void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
}
}
bool SDInterface::checkDetectPin() {
#ifdef KIT
if (digitalRead(SD_DET) == LOW)
return true;
else
return false;
#endif
return false;
}
void SDInterface::main() {
if ((this->supported) && (this->do_save)) {
//Serial.println("Saving packet...");
buffer_obj.forceSave(&SD);
}
else if (!this->supported) {
if (checkDetectPin()) {
delay(100);
this->initSD();
}
}
}
//void SDInterface::savePacket(uint8_t* buf, uint32_t len) {