Implemented DebugVal for DTCs and SanityCheck

This commit is contained in:
2022-09-01 22:46:00 +02:00
parent c6b47fffaf
commit 8c0db2ffd9
5 changed files with 31 additions and 25 deletions

View File

@@ -2,7 +2,7 @@
DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue)
{
for (int i = 0; i < MAX_DTC_STORAGE; i++)
{
@@ -10,10 +10,11 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
{
if (active && DTCStorage[i].active != DTC_ACTIVE)
{
Serial.printf("DTC gone active: %d\n", DTC_no);
Serial.printf("DTC gone active: %d, DebugVal: %d\n", DTC_no, DebugValue);
DTCStorage[i].timestamp = millis();
DTCStorage[i].active = DTC_ACTIVE;
DTCStorage[i].severity = DTC_severity;
DTCStorage[i].debugVal = DebugValue;
}
if (!active && DTCStorage[i].active == DTC_ACTIVE)
{
@@ -32,10 +33,11 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
{
if (DTCStorage[i].Number == DTC_LAST_DTC)
{
Serial.printf("new DTC registered: %d\n", DTC_no);
Serial.printf("new DTC registered: %d, DebugVal: %d\n", DTC_no, DebugValue);
DTCStorage[i].Number = DTC_no;
DTCStorage[i].timestamp = millis();
DTCStorage[i].active = DTC_ACTIVE;
DTCStorage[i].debugVal = DebugValue;
return;
}
}