moved DTC Processing to own File

This commit is contained in:
2023-02-24 19:24:26 +01:00
parent 00cba7b5ac
commit a6031798da
4 changed files with 32 additions and 28 deletions

View File

@@ -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;
}
}