platform: move some startup state reporting from main to platform

This commit is contained in:
Torrie Fischer 2023-12-11 08:04:55 +01:00
parent d592810b3b
commit e9f63e718c
2 changed files with 24 additions and 10 deletions

View File

@ -142,6 +142,30 @@ Platform::bootSplash()
Log.notice(u8" 4: Flash - %d", bootopts.isFlash); Log.notice(u8" 4: Flash - %d", bootopts.isFlash);
#endif #endif
if (bootopts.crashCount > 0) {
Log.warning(u8"Previous crash detected!!!! We're on attempt %d", bootopts.crashCount);
char lastTaskBuf[16];
strncpy(lastTaskBuf, MainLoop::lastTaskName(), sizeof(lastTaskBuf));
lastTaskBuf[15] = 0;
Log.error(u8"Crash occurred in task %s", lastTaskBuf);
#ifdef BOARD_ESP8266
auto rInfo = ESP.getResetInfoPtr();
if (Platform::bootopts.resetReason == REASON_EXCEPTION_RST) {
Log.error("Fatal exception (%d):", rInfo->exccause);
}
Log.error("epc1=%X, epc2=%X, epc3=%X, excvaddr=%X, depc=%X",
rInfo->epc1, rInfo->epc2, rInfo->epc3, rInfo->excvaddr, rInfo->depc);
#endif
strncpy(lastTaskBuf, Renderer::lastFigmentName(), sizeof(lastTaskBuf));
lastTaskBuf[15] = 0;
Log.error(u8"Last Figment was %s", lastTaskBuf);
}
Log.trace("Startup reason: %d", bootopts.resetReason);
Log.trace("Registered tasks:"); Log.trace("Registered tasks:");
auto it = beginTasks(); auto it = beginTasks();
while (it != endTasks()) { while (it != endTasks()) {

View File

@ -87,16 +87,6 @@ void setup() {
Log.notice(u8"🐞 I am built for %d LEDs on pin %d", HardwareConfig::MAX_LED_NUM, RENDERBUG_LED_PIN); Log.notice(u8"🐞 I am built for %d LEDs on pin %d", HardwareConfig::MAX_LED_NUM, RENDERBUG_LED_PIN);
Log.notice(u8"📡 Platform %s version %s", Platform::name(), Platform::version()); Log.notice(u8"📡 Platform %s version %s", Platform::name(), Platform::version());
if (Platform::bootopts.crashCount > 0) {
Log.warning(u8"Previous crash detected!!!! We're on attempt %d", Platform::bootopts.crashCount);
char lastTaskBuf[16];
strncpy(lastTaskBuf, MainLoop::lastTaskName(), sizeof(lastTaskBuf));
lastTaskBuf[15] = 0;
Log.error(u8"Crash occurred in task %s", lastTaskBuf);
}
Log.trace("Startup reason: %d", Platform::bootopts.resetReason);
Log.notice(u8"Setting timezone to +2 (CEST)"); Log.notice(u8"Setting timezone to +2 (CEST)");
Platform::setTimezone(+2); Platform::setTimezone(+2);