stat watchdog
This commit is contained in:
@ -21,7 +21,7 @@ static const uint8_t EEPROM_WREN = 0x06;
|
||||
// static const uint8_t EEPROM_WRSR = 0x01;
|
||||
|
||||
|
||||
static const uint32_t EEPROM_MAGIC = 0xaffe000a;
|
||||
static const uint32_t EEPROM_MAGIC = 0xaffe000b;
|
||||
|
||||
|
||||
static const uint16_t EEPROM_HEADER_ADDR = EEPROM_BASE_ADDR;
|
||||
@ -114,14 +114,10 @@ void eepromSpiTxCpltCallback(SPI_HandleTypeDef *hspi) {
|
||||
static void eepromHourlyUpdateDeviceStats(void *handle) {
|
||||
deviceStats.s.totalRunningHours += 1;
|
||||
|
||||
deviceStats.s.totalRequests += 0;
|
||||
deviceStats.s.totalFailures += 0;
|
||||
|
||||
logMsg("eeHUDS, about to write updated device stats");
|
||||
logMsg("eeHUDS, total powercycles so far: %d", deviceStats.s.totalPowercycles);
|
||||
logMsg("eeHUDS, total running hours so far: %d", deviceStats.s.totalRunningHours);
|
||||
logMsg("eeHUDS, total requests so far: %d", deviceStats.s.totalRequests);
|
||||
logMsg("eeHUDS, total failures so far: %d", deviceStats.s.totalFailures);
|
||||
logMsg("eeHUDS, total watchdog resets: %d", deviceStats.s.totalWatchdogResets);
|
||||
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
}
|
||||
@ -154,8 +150,7 @@ void eepromInit() {
|
||||
|
||||
deviceStats.s.totalPowercycles = 0;
|
||||
deviceStats.s.totalRunningHours = 0;
|
||||
deviceStats.s.totalRequests = 0;
|
||||
deviceStats.s.totalFailures = 0;
|
||||
deviceStats.s.totalWatchdogResets = 0;
|
||||
logMsg("eeI, about to write device stats for the first time");
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
eepromActiveDelay(EEPROM_AFTER_WRITE_DELAY);
|
||||
@ -180,10 +175,13 @@ void eepromInit() {
|
||||
eepromRead(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
logMsg("eeI, total powercycles so far: %d", deviceStats.s.totalPowercycles);
|
||||
logMsg("eeI, total running hours so far: %d", deviceStats.s.totalRunningHours);
|
||||
logMsg("eeI, total requests so far: %d", deviceStats.s.totalRequests);
|
||||
logMsg("eeI, total failures so far: %d", deviceStats.s.totalFailures);
|
||||
logMsg("eeI, total watchdog resets: %d", deviceStats.s.totalWatchdogResets);
|
||||
|
||||
deviceStats.s.totalPowercycles += 1;
|
||||
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST)) {
|
||||
logMsg("eeI, this was a watchdog reset");
|
||||
deviceStats.s.totalWatchdogResets += 1;
|
||||
}
|
||||
logMsg("eeI, about to write device stats with updated power cycles counter");
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
eepromActiveDelay(EEPROM_AFTER_WRITE_DELAY);
|
||||
|
Reference in New Issue
Block a user