Fixed Bug in DTC-Handling

This commit is contained in:
Marcel Peterkau 2022-05-01 15:15:32 +02:00
parent 872f577d35
commit 818d5843b3
5 changed files with 40 additions and 8 deletions

View File

@ -106,12 +106,12 @@
</div>
</div>
</form>
<div class="alert alert-warning col-xs-offset-5 col-xs-7">
</p>
<div class="alert alert-warning">
<strong>Achtung!</strong><br>
Bei Änderung der Wegstrecken-Quelle wird der CAN-Oiler neu gestartet.<br>
Bei Änderung der Wegstrecken-Quelle wird der CAN-Oiler neu gestartet.
Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
</div>
</p>
<!-- Div Source:Impulse Settings-->
<div %SHOW_IMPULSE_SETTINGS%>
<h4>Einstellungen Impuls</h4>

View File

@ -7,7 +7,7 @@
typedef enum DTCNums_e
{
DTC_NO_GPS_SERIAL,
DTC_NO_GPS_SERIAL = 1,
DTC_TANK_EMPTY,
DTC_NO_EEPROM_FOUND,
DTC_EEPROM_CFG_BAD,
@ -19,9 +19,9 @@ typedef enum DTCNums_e
typedef enum DTCActive_e
{
DTC_NONE,
DTC_ACTIVE,
DTC_PREVIOUS,
DTC_NONE
DTC_PREVIOUS
} DTCActive_t;
typedef struct DTCEntry_s

View File

@ -67,6 +67,7 @@ void RemoteDebug_printWifiInfo();
void RemoteDebug_CheckEEPOM();
void RemoteDebug_dumpConfig();
void RemoteDebug_dumpPersistance();
void RemoteDebug_ShowDTCs();
#endif
#ifdef WIFI_CLIENT
@ -265,6 +266,8 @@ void processCmdRemoteDebug()
RemoteDebug_dumpPersistance();
else if (lastCmd == "saveEE")
StoreConfig_EEPROM();
else if (lastCmd == "showdtc")
RemoteDebug_ShowDTCs();
}
void RemoteDebug_formatCFG()
@ -721,4 +724,32 @@ uint32_t Process_Impulse_WheelSpeed()
wheel_pulse = 0;
return add_milimeters;
}
void RemoteDebug_ShowDTCs()
{
char buff_timestamp[16]; // Format: DD-hh:mm:ss:xxx
char buff_active[9];
for (uint32_t i = 0; i < MAX_DTC_STORAGE; i++)
{
if (DTCStorage[i].Number < DTC_LAST_DTC)
{
sprintf(buff_timestamp, "%02d-%02d:%02d:%02d:%03d",
DTCStorage[i].timestamp / 86400000, // Days
DTCStorage[i].timestamp / 360000 % 24, // Hours
DTCStorage[i].timestamp / 60000 % 60, // Minutes
DTCStorage[i].timestamp / 1000 % 60, // Seconds
DTCStorage[i].timestamp % 1000); // milliseconds
if (DTCStorage[i].active == DTC_ACTIVE)
strcpy(buff_active, "active");
else if (DTCStorage[i].active == DTC_PREVIOUS)
strcpy(buff_active, "previous");
else
strcpy(buff_active, "none");
debugA("%s \t %6d \t %s", buff_timestamp, DTCStorage[i].Number, buff_active);
}
}
}

View File

@ -8,4 +8,5 @@ const char helpCmd[] = "sysinfo - System Info\r\n"
"resetPageEE - Reset the PersistenceData Page\r\n"
"dumpCFG - print Config struct\r\n"
"dumpPDS - print PersistanceStruct\r\n"
"saveEE - save EE-Data\r\n";
"saveEE - save EE-Data\r\n"
"showdtc - Show all DTCs\r\n";

View File

@ -95,7 +95,7 @@ String processor(const String &var)
for (uint32_t i = 0; i < MAX_DTC_STORAGE; i++)
{
if (DTCStorage[i].Number > 0)
if (DTCStorage[i].Number < DTC_LAST_DTC)
{
sprintf(buff_timestamp, "%02d-%02d:%02d:%02d:%03d",
DTCStorage[i].timestamp / 86400000, // Days