DTC in WebUI now handled via Websocket
This commit is contained in:
@@ -175,12 +175,20 @@ void processCmdDebug(String command)
|
||||
Debug_dumpPersistance();
|
||||
else if (command == "saveEE")
|
||||
globals.requestEEAction = EE_ALL_SAVE;
|
||||
else if (command == "showdtc")
|
||||
Debug_ShowDTCs();
|
||||
else if (command == "dumpGlobals")
|
||||
Debug_dumpGlobals();
|
||||
else if (command == "sdbg")
|
||||
SetDebugportStatus(dbg_Serial, enabled);
|
||||
else if (command == "dtc_show")
|
||||
Debug_ShowDTCs();
|
||||
else if (command == "dtc_clear")
|
||||
ClearAllDTC();
|
||||
else if (command == "dtc_crit")
|
||||
MaintainDTC(DTC_FAKE_DTC_CRIT, true, millis());
|
||||
else if (command == "dtc_warn")
|
||||
MaintainDTC(DTC_FAKE_DTC_WARN, true, millis());
|
||||
else if (command == "dtc_info")
|
||||
MaintainDTC(DTC_FAKE_DTC_INFO, true, millis());
|
||||
else
|
||||
Debug_pushMessage("unknown Command\n");
|
||||
}
|
||||
@@ -212,9 +220,9 @@ void Debug_printSystemInfo()
|
||||
Debug_pushMessage("Flash Size: %d\n", ESP.getFlashChipRealSize());
|
||||
Debug_pushMessage("Flash Size IDE: %d\n", ESP.getFlashChipSize());
|
||||
Debug_pushMessage("Flash ide mode: %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT"
|
||||
: ideMode == FM_DIO ? "DIO"
|
||||
: ideMode == FM_DOUT ? "DOUT"
|
||||
: "UNKNOWN"));
|
||||
: ideMode == FM_DIO ? "DIO"
|
||||
: ideMode == FM_DOUT ? "DOUT"
|
||||
: "UNKNOWN"));
|
||||
Debug_pushMessage("OTA-Pass: %s\n", QUOTE(ADMIN_PASSWORD));
|
||||
Debug_pushMessage("Git-Revison: %s\n", constants.GitHash);
|
||||
Debug_pushMessage("Sw-Version: %d.%02d\n", constants.FW_Version_major, constants.FW_Version_minor);
|
||||
|
@@ -13,4 +13,6 @@
|
||||
11; DTC_CAN_TRANSCEIVER_FAILED; DTC_CRITICAL; CAN-Transceiver Error; Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Prüfen Sie die Hardware auf Defekte
|
||||
12; DTC_NO_CAN_SIGNAL; DTC_WARN; Keine CAN-Verbindung; Es konnte kein CAN-Signal empfangen werden. Prüfen sie die Verbindung und die Einstellungen
|
||||
13; DTC_EEPROM_CFG_SANITY; DTC_WARN; Config-Validierung; Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen
|
||||
|
||||
14; DTC_FAKE_DTC_INFO; DTC_INFO; Dummy-DTC Info; Ein Dummy-DTC der Schwere "Info" für Debugging-Zwecke
|
||||
15; DTC_FAKE_DTC_WARN; DTC_WARN; Dummy-DTC Warnung; Ein Dummy-DTC der Schwere "Warnung" für Debugging-Zwecke
|
||||
16; DTC_FAKE_DTC_CRIT; DTC_CRITICAL; Dummy-DTC Kritisch; Ein Dummy-DTC der Schwere "Kritisch" für Debugging-Zwecke
|
@@ -67,7 +67,15 @@ void initWebUI()
|
||||
void Webserver_Process()
|
||||
{
|
||||
#ifdef FEATURE_ENABLE_WEBSOCKETS
|
||||
static uint32_t previousMillis = 0;
|
||||
|
||||
webSocket.cleanupClients();
|
||||
|
||||
if ((webSocket.count() > 0) && (millis() - previousMillis >= 10000))
|
||||
{
|
||||
Websocket_RefreshClientData_DTCs();
|
||||
previousMillis = millis();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -161,58 +169,6 @@ String processor(const String &var)
|
||||
#else
|
||||
return "hidden";
|
||||
#endif
|
||||
if (var == "SHOW_DTC_TABLE")
|
||||
return globals.hasDTC ? "" : "hidden";
|
||||
|
||||
if (var == "DTC_TABLE")
|
||||
{
|
||||
String temp = "";
|
||||
char buff_timestamp[16]; // Format: DD-hh:mm:ss:xxx
|
||||
|
||||
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
|
||||
|
||||
temp = temp + "<tr data-dtc=" + String(DTCStorage[i].Number);
|
||||
temp = temp + " data-debugval=" + String(DTCStorage[i].debugVal) + "><td>" + String(buff_timestamp);
|
||||
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
||||
temp = temp + "<img src=static/img/";
|
||||
switch (getSeverityForDTC(DTCStorage[i].Number))
|
||||
{
|
||||
case DTC_CRITICAL:
|
||||
temp = temp + "critical";
|
||||
break;
|
||||
case DTC_WARN:
|
||||
temp = temp + "warn";
|
||||
break;
|
||||
case DTC_INFO:
|
||||
temp = temp + "info";
|
||||
break;
|
||||
case DTC_NONE:
|
||||
temp = temp + "none";
|
||||
break;
|
||||
}
|
||||
temp = temp + ".png></td><td>";
|
||||
|
||||
if (DTCStorage[i].active == DTC_ACTIVE)
|
||||
temp = temp + "active";
|
||||
else if (DTCStorage[i].active == DTC_PREVIOUS)
|
||||
temp = temp + "previous";
|
||||
else
|
||||
temp = temp + "none";
|
||||
|
||||
temp = temp + "</td></tr>";
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
if (var == "SOURCE_SELECT_OPTIONS")
|
||||
{
|
||||
@@ -685,6 +641,33 @@ void Websocket_HandleMessage(void *arg, uint8_t *data, size_t len)
|
||||
|
||||
void Websocket_PushLiveDebug(String Message)
|
||||
{
|
||||
webSocket.textAll(Message + "\n");
|
||||
webSocket.textAll("DEBUG:" + Message);
|
||||
}
|
||||
|
||||
void Websocket_RefreshClientData_DTCs()
|
||||
{
|
||||
String temp = "";
|
||||
|
||||
// Build DTC-String
|
||||
if (globals.hasDTC != true)
|
||||
{
|
||||
temp = "DTC:" + String(DTC_NO_DTC) + ";";
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = "DTC:";
|
||||
for (uint32_t i = 0; i < MAX_DTC_STORAGE; i++)
|
||||
{
|
||||
if (DTCStorage[i].Number < DTC_LAST_DTC)
|
||||
{
|
||||
temp = temp + String(DTCStorage[i].timestamp) + ",";
|
||||
temp = temp + String(DTCStorage[i].Number) + ",";
|
||||
temp = temp + String(getSeverityForDTC(DTCStorage[i].Number)) + ",";
|
||||
temp = temp + String(DTCStorage[i].active) + ",";
|
||||
temp = temp + String(DTCStorage[i].debugVal) + ";";
|
||||
}
|
||||
}
|
||||
}
|
||||
webSocket.textAll(temp);
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user