DTCs now hav severity and improved DTCMaintenance

This commit is contained in:
2022-08-22 14:13:55 +02:00
parent 808709f5c2
commit bd4c1d9d53
14 changed files with 109 additions and 29 deletions

View File

@@ -5,23 +5,35 @@ uint32_t lubePulseTimestamp = 0;
void RunLubeApp(uint32_t add_milimeters)
{
MaintainDTC(DTC_TANK_EMPTY, (PersistenceData.tankRemain_µl < LubeConfig.amountPerDose_µl));
globals.TankPercentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 1000);
MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_µl < LubeConfig.amountPerDose_µl));
MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage));
static tSystem_Status preserverSysStatusError;
if (globals.systemStatus != sysStat_Error)
preserverSysStatusError = globals.systemStatus;
if (getlastDTC(true) < DTC_LAST_DTC)
if (getlastDTC(false) < DTC_LAST_DTC)
{
globals.systemStatus = sysStat_Error;
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
{
if (globals.systemStatus == sysStat_Error)
{
globals.systemStatus = preserverSysStatusError;
}
globals.hasDTC = false;
}
// Add traveled Distance in mm