firmware WIP

This commit is contained in:
Marcus 2024-04-13 19:10:57 +02:00
parent dc10435d81
commit 3b374e32b4

View file

@ -376,17 +376,23 @@ int getLightchirp() {
void wipeEEPROM() {
// i is helper variable. We reuse it later here again.
// i is helper variable. We use it in this function multiple times.
// when doing this, ensure every time to set i to 0 again before reusing
byte i = 0;
Serial.println(":: wipe EEPROM ::");
while(digitalRead(PIN_WIPE) == LOW ) {
// only show the Serial message once
if(i == 0) {
Serial.println("Please release PIN_WIPE to erase all data saved in EEPROM");
Serial.println("LAST CHANCE TO KEEP THE DATA WHEN RESETTING NOW!!");
}
Serial.println("LAST CHANCE TO KEEP THE DATA BY RESETTING NOW!!");
// increase i to show the serial message only once
i = 1;
}
delay(500);
}
// write a 0 to all 512 bytes of the EEPROM
Serial.print("wiping EEPROM... ");
@ -535,7 +541,6 @@ void setup() {
// when PIN_WIPE is set to LOW, wipe EEPROM
if(digitalRead(PIN_WIPE) == LOW) {
Serial.print("PIN_WIPE (D4) is set to LOW, wiping EEPROM now..");
// wipe EEPROM
wipeEEPROM();
}