Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,26 @@ static void waitEnterSleep(bool skipPreflight = false)
if (!Throttle::isWithinTimespanMs(now,
THIRTY_SECONDS_MS)) { // If we wait too long just report an error and go to sleep
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_SLEEP_ENTER_WAIT);
assert(0); // FIXME - for now we just restart, need to fix bug #167
// FIXME issue #167: a misbehaving observer can veto sleep forever.
// Restart cleanly rather than panicking — same effective recovery,
// no core-dump pollution, and the firmware can come back up with a
// working state machine instead of triggering the panic handler.
LOG_ERROR("Preflight sleep wait exceeded 30s, restarting");
// Notify reboot observers (e.g. InkHUD) so they can persist /
// shut down cleanly, matching Power::reboot's contract.
notifyReboot.notifyObservers(NULL);
console->flush();
#if defined(ARCH_ESP32)
ESP.restart();
#elif defined(ARCH_NRF52)
NVIC_SystemReset();
#elif defined(ARCH_RP2040)
rp2040.reboot();
#elif defined(ARCH_STM32WL)
HAL_NVIC_SystemReset();
Comment thread
DatanoiseTV marked this conversation as resolved.
#else
assert(0); // fallback for archs without a clean restart primitive
#endif
break;
Comment on lines +202 to 220
}
}
Expand Down
Loading