diff --git a/Software/src/dtc.cpp b/Software/src/dtc.cpp index 96df7b0..23a0f55 100644 --- a/Software/src/dtc.cpp +++ b/Software/src/dtc.cpp @@ -107,4 +107,33 @@ DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity) } return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC; +} + +void DTC_Process() +{ + static tSystem_Status preserverSysStatusError; + + if (getlastDTC(false) < DTC_LAST_DTC) + { + globals.hasDTC = true; + if (getlastDTC_Severity(true, DTC_CRITICAL) < DTC_LAST_DTC) + { + if (globals.systemStatus != sysStat_Error) + { + preserverSysStatusError = globals.systemStatus; + } + globals.systemStatus = sysStat_Error; + } + else + { + if (globals.systemStatus == sysStat_Error) + { + globals.systemStatus = preserverSysStatusError; + } + } + } + else + { + globals.hasDTC = false; + } } \ No newline at end of file diff --git a/Software/src/dtc.h b/Software/src/dtc.h index 6543cf7..f08645c 100644 --- a/Software/src/dtc.h +++ b/Software/src/dtc.h @@ -55,6 +55,7 @@ void ClearDTC(DTCNums_t DTC_no); void ClearAllDTC(); DTCNums_t getlastDTC(boolean only_active); DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity); +void DTC_Process(); extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE]; #endif \ No newline at end of file diff --git a/Software/src/lubeapp.cpp b/Software/src/lubeapp.cpp index 906235b..08889d6 100644 --- a/Software/src/lubeapp.cpp +++ b/Software/src/lubeapp.cpp @@ -10,32 +10,6 @@ void RunLubeApp(uint32_t add_milimeters) MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_microL < LubeConfig.amountPerDose_microL)); MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage)); - static tSystem_Status preserverSysStatusError; - - if (getlastDTC(false) < DTC_LAST_DTC) - { - globals.hasDTC = true; - if (getlastDTC_Severity(true, DTC_CRITICAL) < DTC_LAST_DTC) - { - if (globals.systemStatus != sysStat_Error) - { - preserverSysStatusError = globals.systemStatus; - } - globals.systemStatus = sysStat_Error; - } - else - { - if (globals.systemStatus == sysStat_Error) - { - globals.systemStatus = preserverSysStatusError; - } - } - } - else - { - globals.hasDTC = false; - } - // Add traveled Distance in mm PersistenceData.TravelDistance_highRes_mm += add_milimeters; PersistenceData.odometer_mm += add_milimeters; diff --git a/Software/src/main.cpp b/Software/src/main.cpp index bc4bab0..1061f77 100644 --- a/Software/src/main.cpp +++ b/Software/src/main.cpp @@ -185,7 +185,6 @@ void loop() } RunLubeApp(wheelDistance); - EEPROMCyclicPDSTicker.update(); #ifdef FEATURE_ENABLE_OLED Display_Process(); #endif @@ -193,9 +192,10 @@ void loop() LED_Process(); EEPROM_Process(); Webserver_Process(); + DTC_Process(); ArduinoOTA.handle(); - + EEPROMCyclicPDSTicker.update(); #ifdef FEATURE_ENABLE_WIFI_CLIENT WiFiMaintainConnectionTicker.update(); #endif