From 818d5843b3c8260a80fe3eba671ec22cace537c2 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Sun, 1 May 2022 15:15:32 +0200 Subject: [PATCH] Fixed Bug in DTC-Handling --- Software/ChainLube/data/index.htm | 6 +++--- Software/ChainLube/src/dtc.h | 6 +++--- Software/ChainLube/src/main.cpp | 31 +++++++++++++++++++++++++++++ Software/ChainLube/src/rmtdbghelp.h | 3 ++- Software/ChainLube/src/webui.cpp | 2 +- 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Software/ChainLube/data/index.htm b/Software/ChainLube/data/index.htm index a93ddf9..6c3f68b 100644 --- a/Software/ChainLube/data/index.htm +++ b/Software/ChainLube/data/index.htm @@ -106,12 +106,12 @@ -
+

+
Achtung!
- Bei Ă„nderung der Wegstrecken-Quelle wird der CAN-Oiler neu gestartet.
+ Bei Ă„nderung der Wegstrecken-Quelle wird der CAN-Oiler neu gestartet. Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
-

Einstellungen Impuls

diff --git a/Software/ChainLube/src/dtc.h b/Software/ChainLube/src/dtc.h index 2c5d1f7..f0627d3 100644 --- a/Software/ChainLube/src/dtc.h +++ b/Software/ChainLube/src/dtc.h @@ -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 diff --git a/Software/ChainLube/src/main.cpp b/Software/ChainLube/src/main.cpp index 4c9b532..db74709 100644 --- a/Software/ChainLube/src/main.cpp +++ b/Software/ChainLube/src/main.cpp @@ -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); + } + } } \ No newline at end of file diff --git a/Software/ChainLube/src/rmtdbghelp.h b/Software/ChainLube/src/rmtdbghelp.h index 2ae15d7..b02053c 100644 --- a/Software/ChainLube/src/rmtdbghelp.h +++ b/Software/ChainLube/src/rmtdbghelp.h @@ -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"; \ No newline at end of file + "saveEE - save EE-Data\r\n" + "showdtc - Show all DTCs\r\n"; \ No newline at end of file diff --git a/Software/ChainLube/src/webui.cpp b/Software/ChainLube/src/webui.cpp index 50373c5..6ca6025 100644 --- a/Software/ChainLube/src/webui.cpp +++ b/Software/ChainLube/src/webui.cpp @@ -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