platform: esp32: fix build, implement more crash info output
This commit is contained in:
parent
389da5b115
commit
13a3dd5158
@ -7,6 +7,32 @@ __NOINIT_ATTR static uint8_t s_rebootCount;
|
|||||||
__NOINIT_ATTR static uint16_t s_forceSafeMode;
|
__NOINIT_ATTR static uint16_t s_forceSafeMode;
|
||||||
#define SAFE_MODE_MAGIC 6942
|
#define SAFE_MODE_MAGIC 6942
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void
|
||||||
|
PlatformImpl<HAL_ESP32>::forceSafeMode()
|
||||||
|
{
|
||||||
|
s_forceSafeMode = SAFE_MODE_MAGIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void
|
||||||
|
PlatformImpl<HAL_ESP32>::bootSplash()
|
||||||
|
{
|
||||||
|
Log.trace("ESP32 startup reason: %d", Platform::bootopts.resetReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void
|
||||||
|
PlatformImpl<HAL_ESP32>::printCrashInfo()
|
||||||
|
{
|
||||||
|
/*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);*/
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void
|
||||||
PlatformImpl<HAL_ESP32>::initBootOptions(BootOptions& opts)
|
PlatformImpl<HAL_ESP32>::initBootOptions(BootOptions& opts)
|
||||||
@ -18,12 +44,12 @@ PlatformImpl<HAL_ESP32>::initBootOptions(BootOptions& opts)
|
|||||||
// on platformio builds
|
// on platformio builds
|
||||||
if (opts.crashCount++ >= 3) {
|
if (opts.crashCount++ >= 3) {
|
||||||
// Boot into safe mode if the watchdog reset us three times in a row.
|
// Boot into safe mode if the watchdog reset us three times in a row.
|
||||||
isSafeMode = true;
|
opts.isSafeMode = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
opts.crashCount = 0;
|
opts.crashCount = 0;
|
||||||
}
|
}
|
||||||
s_rebootCount = crashCount;
|
s_rebootCount = opts.crashCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -44,8 +70,8 @@ template<>
|
|||||||
const char*
|
const char*
|
||||||
PlatformImpl<HAL_ESP32>::deviceID()
|
PlatformImpl<HAL_ESP32>::deviceID()
|
||||||
{
|
{
|
||||||
uint64_t chipid;
|
static char s_deviceID[15];
|
||||||
chipid = ESP.getEfuseMac();
|
uint64_t chipid = ESP.getEfuseMac();
|
||||||
snprintf(s_deviceID, sizeof(s_deviceID), "%08X", (uint32_t)chipid);
|
snprintf(s_deviceID, sizeof(s_deviceID), "%08X", (uint32_t)chipid);
|
||||||
return s_deviceID;
|
return s_deviceID;
|
||||||
}
|
}
|
||||||
@ -95,6 +121,7 @@ PlatformImpl<HAL_ESP32>::getLocalTime(struct tm* timedata, int timezone)
|
|||||||
memset(&rawtime, 0, sizeof(rawtime));
|
memset(&rawtime, 0, sizeof(rawtime));
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
(*timedata) = (*localtime(&rawtime));
|
(*timedata) = (*localtime(&rawtime));
|
||||||
|
timedata->tm_hour += timezone;
|
||||||
return (timedata->tm_year > (2016-1990));
|
return (timedata->tm_year > (2016-1990));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user