build for esp32 mask project
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
#include "BootOptions.h"
|
||||
#ifdef BOARD_ESP8266
|
||||
#include <ESP8266WiFi.h>
|
||||
#endif
|
||||
#include <EEPROM.h>
|
||||
#include "Config.h"
|
||||
|
||||
#ifdef PLATFORM_PHOTON
|
||||
LEDStatus serialStatus = LEDStatus(RGB_COLOR_ORANGE, LED_PATTERN_FADE, LED_SPEED_FAST, LED_PRIORITY_BACKGROUND);
|
||||
@@ -31,6 +36,28 @@ BootOptions::BootOptions()
|
||||
configStatus.setActive(isSetup);
|
||||
serialStatus.setActive(isSerial);
|
||||
#endif
|
||||
#ifdef BOARD_ESP8266
|
||||
struct rst_info resetInfo = *ESP.getResetInfoPtr();
|
||||
uint8_t crashCount;
|
||||
EEPROM.begin(sizeof(crashCount));
|
||||
EEPROM.get(sizeof(HardwareConfig) + 32, crashCount);
|
||||
EEPROM.end();
|
||||
if (resetInfo.reason == REASON_WDT_RST) {
|
||||
if (crashCount++ >= 3) {
|
||||
// Boot into safe mode if the watchdog reset us three times in a row.
|
||||
isSafeMode = true;
|
||||
} else {
|
||||
EEPROM.begin(sizeof(crashCount));
|
||||
EEPROM.put(sizeof(HardwareConfig) + 32, crashCount);
|
||||
EEPROM.end();
|
||||
}
|
||||
} else if (crashCount != 0) {
|
||||
crashCount = 0;
|
||||
EEPROM.begin(sizeof(crashCount));
|
||||
EEPROM.put(sizeof(HardwareConfig) + 32, crashCount);
|
||||
EEPROM.end();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user