|
|
@ -141,9 +141,11 @@ unsigned char customReset() { |
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if SYSTEM_CHECK_ENABLED
|
|
|
|
|
|
|
|
// Call this method on boot with start=true to increase the crash counter
|
|
|
|
// Call it again once the system is stable to decrease the counter
|
|
|
|
// If the counter reaches CRASH_COUNT_MAX then the system is flagged as unstable
|
|
|
|
// If the counter reaches SYSTEM_CHECK_MAX then the system is flagged as unstable
|
|
|
|
// setting _systemOK = false;
|
|
|
|
//
|
|
|
|
// An unstable system will only have serial access, WiFi in AP mode and OTA
|
|
|
@ -156,7 +158,7 @@ void systemCheck(bool stable) { |
|
|
|
value = 0; |
|
|
|
DEBUG_MSG_P(PSTR("[MAIN] System OK\n")); |
|
|
|
} else { |
|
|
|
if (++value > CRASH_COUNT_MAX) { |
|
|
|
if (++value > SYSTEM_CHECK_MAX) { |
|
|
|
_systemStable = false; |
|
|
|
value = 0; |
|
|
|
DEBUG_MSG_P(PSTR("[MAIN] System UNSTABLE\n")); |
|
|
@ -170,6 +172,17 @@ bool systemCheck() { |
|
|
|
return _systemStable; |
|
|
|
} |
|
|
|
|
|
|
|
void systemCheckLoop() { |
|
|
|
static bool checked = false; |
|
|
|
if (!checked && (millis() > SYSTEM_CHECK_TIME)) { |
|
|
|
// Check system as stable
|
|
|
|
systemCheck(true); |
|
|
|
checked = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
char * ltrim(char * s) { |
|
|
|