firmware WIP
This commit is contained in:
parent
dc10435d81
commit
3b374e32b4
1 changed files with 10 additions and 5 deletions
|
@ -376,17 +376,23 @@ int getLightchirp() {
|
||||||
|
|
||||||
void wipeEEPROM() {
|
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;
|
byte i = 0;
|
||||||
|
|
||||||
|
|
||||||
|
Serial.println(":: wipe EEPROM ::");
|
||||||
|
|
||||||
while(digitalRead(PIN_WIPE) == LOW ) {
|
while(digitalRead(PIN_WIPE) == LOW ) {
|
||||||
// only show the Serial message once
|
// only show the Serial message once
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
Serial.println("Please release PIN_WIPE to erase all data saved in EEPROM");
|
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
|
// increase i to show the serial message only once
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
|
||||||
// write a 0 to all 512 bytes of the EEPROM
|
// write a 0 to all 512 bytes of the EEPROM
|
||||||
Serial.print("wiping EEPROM... ");
|
Serial.print("wiping EEPROM... ");
|
||||||
|
@ -535,7 +541,6 @@ void setup() {
|
||||||
|
|
||||||
// when PIN_WIPE is set to LOW, wipe EEPROM
|
// when PIN_WIPE is set to LOW, wipe EEPROM
|
||||||
if(digitalRead(PIN_WIPE) == LOW) {
|
if(digitalRead(PIN_WIPE) == LOW) {
|
||||||
Serial.print("PIN_WIPE (D4) is set to LOW, wiping EEPROM now..");
|
|
||||||
// wipe EEPROM
|
// wipe EEPROM
|
||||||
wipeEEPROM();
|
wipeEEPROM();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue