add i2c fatal error counter
This commit is contained in:
@ -31,8 +31,9 @@
|
||||
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
|
||||
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
|
||||
|
||||
CoreController::CoreController(object_id_t objectId)
|
||||
: ExtendedControllerBase(objectId, 5), opDivider5(5), opDivider10(10), hkSet(this) {
|
||||
CoreController::CoreController(object_id_t objectId, const std::atomic_uint16_t& i2cErrors)
|
||||
: ExtendedControllerBase(objectId, 5), opDivider5(5), opDivider10(10), hkSet(this),
|
||||
i2cErrors(i2cErrors) {
|
||||
try {
|
||||
sdcMan = SdCardManager::instance();
|
||||
if (sdcMan == nullptr) {
|
||||
@ -100,6 +101,12 @@ void CoreController::performControlOperation() {
|
||||
sdStateMachine();
|
||||
performMountedSdCardOperations();
|
||||
readHkData();
|
||||
if(i2cErrors >= 5) {
|
||||
bool protOpPerformed = false;
|
||||
triggerEvent(I2C_UNAVAILABLE_REBOOT);
|
||||
gracefulShutdownTasks(CURRENT_CHIP, CURRENT_COPY, protOpPerformed);
|
||||
std::system("xsc_boot_copy -r");
|
||||
}
|
||||
opDivider5.checkAndIncrement();
|
||||
opDivider10.checkAndIncrement();
|
||||
}
|
||||
|
Reference in New Issue
Block a user