syslog
This commit is contained in:
@ -136,16 +136,16 @@ void eepromInit() {
|
||||
|
||||
logMsg("eeI, read header");
|
||||
eepromRead(EEPROM_HEADER_ADDR, eepromHeader.b, sizeof(eepromHeader));
|
||||
coloredMsg(LOG_RED, "eeI, magic: %08x", eepromHeader.s.magic);
|
||||
logMsg("eeI, magic: %08x", eepromHeader.s.magic);
|
||||
|
||||
if (eepromHeader.s.magic != EEPROM_MAGIC) {
|
||||
coloredMsg(LOG_RED, "eeI, eeprom is uninitialized");
|
||||
logMsg("eeI, eeprom is uninitialized");
|
||||
|
||||
deviceStats.s.totalPowercycles = 0;
|
||||
deviceStats.s.totalRunningHours = 0;
|
||||
deviceStats.s.totalRequests = 0;
|
||||
deviceStats.s.totalFailures = 0;
|
||||
coloredMsg(LOG_RED, "eeI, about to write device stats for the first time");
|
||||
logMsg("eeI, about to write device stats for the first time");
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
eepromActiveDelay(7);
|
||||
|
||||
@ -158,35 +158,35 @@ void eepromInit() {
|
||||
eepromActiveDelay(7);
|
||||
}
|
||||
}
|
||||
coloredMsg(LOG_RED, "eeI, storage blocks initialized");
|
||||
logMsg("eeI, storage blocks initialized");
|
||||
|
||||
|
||||
eepromHeader.s.magic = EEPROM_MAGIC;
|
||||
eepromHeader.s.activeBlock = 0;
|
||||
eepromHeader.s.writeCounter = 1;
|
||||
coloredMsg(LOG_RED, "eeI, about to write header for the first time");
|
||||
logMsg("eeI, about to write header for the first time");
|
||||
eepromWrite(EEPROM_HEADER_ADDR, eepromHeader.b, sizeof(eepromHeader));
|
||||
eepromActiveDelay(7);
|
||||
coloredMsg(LOG_GREEN, "eeI, eeprom has been initialized");
|
||||
logMsg("eeI, eeprom has been initialized");
|
||||
} else {
|
||||
coloredMsg(LOG_GREEN, "eeI, eeprom is initialized");
|
||||
logMsg("eeI, eeprom is initialized");
|
||||
}
|
||||
|
||||
coloredMsg(LOG_GREEN, "eeI, about to read device stats");
|
||||
logMsg("eeI, about to read device stats");
|
||||
eepromRead(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
coloredMsg(LOG_GREEN, "eeI, total powercycles so far: %d", deviceStats.s.totalPowercycles);
|
||||
coloredMsg(LOG_GREEN, "eeI, total running hours so far: %d", deviceStats.s.totalRunningHours);
|
||||
coloredMsg(LOG_GREEN, "eeI, total requests so far: %d", deviceStats.s.totalRequests);
|
||||
coloredMsg(LOG_GREEN, "eeI, total failures so far: %d", deviceStats.s.totalFailures);
|
||||
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);
|
||||
|
||||
t_mbusCommStats stats = { .requestCnt = deviceStats.s.totalRequests, .errorCnt = deviceStats.s.totalFailures};
|
||||
mbusCommSetStats(stats);
|
||||
|
||||
deviceStats.s.totalPowercycles += 1;
|
||||
coloredMsg(LOG_GREEN, "eeI, about to write device stats with updated power cycles counter");
|
||||
logMsg("eeI, about to write device stats with updated power cycles counter");
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
eepromActiveDelay(7);
|
||||
|
||||
schAdd(eepromHourlyUpdateDeviceStats, NULL, 0, 60 * 60 * 1000);
|
||||
coloredMsg(LOG_GREEN, "eeI, hourly device stats update scheduled");
|
||||
logMsg("eeI, hourly device stats update scheduled");
|
||||
}
|
||||
|
Reference in New Issue
Block a user