- Abstract the memory stats into its own class.

- Fix a bug with debug mqtt
- nrf52 needs more love, there's a strange error while linking. Help appreciated
This commit is contained in:
Thomas Göttgens
2023-02-17 12:31:51 +01:00
parent e2f5e9206d
commit 4967a16abe
8 changed files with 91 additions and 25 deletions

View File

@@ -134,16 +134,14 @@ static int32_t ledBlinker()
setLed(ledOn);
#ifdef ARCH_ESP32
auto newHeap = ESP.getFreeHeap();
if (newHeap < 11000) {
LOG_DEBUG("\n\n====== heap too low [11000] -> reboot in 1s ======\n\n");
auto newHeap = memGet.getFreeHeap();
if (newHeap < 10000) {
LOG_DEBUG("\n\n====== heap too low [10000] -> reboot in 1s ======\n\n");
#ifdef HAS_SCREEN
screen->startRebootScreen();
#endif
rebootAtMsec = millis() + 900;
}
#endif
// have a very sparse duty cycle of LED being on, unless charging, then blink 0.5Hz square wave rate to indicate that
return powerStatus->getIsCharging() ? 1000 : (ledOn ? 1 : 1000);