reworked DTC-Data handling
This commit is contained in:
parent
d593e40f38
commit
2138f640ee
142
Software/build_dtcs.py
Normal file
142
Software/build_dtcs.py
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
import os
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Pfad zur Eingabedatei und Ausgabedatei
|
||||||
|
input_file = "src/dtc_defs.txt"
|
||||||
|
output_file = "include/dtc_defs.h"
|
||||||
|
json_output_file = "data_src/static/dtc_table.json"
|
||||||
|
|
||||||
|
# Überprüfen, ob das Verzeichnis existiert, andernfalls erstellen
|
||||||
|
json_output_dir = os.path.dirname(json_output_file)
|
||||||
|
if not os.path.exists(json_output_dir):
|
||||||
|
os.makedirs(json_output_dir)
|
||||||
|
|
||||||
|
# Mehrdimensionales Array zum Speichern der Zeilen aus der Eingabedatei
|
||||||
|
dtc_lines = []
|
||||||
|
|
||||||
|
# Lesen und analysieren der Eingabedatei
|
||||||
|
with open(input_file, "r", encoding="utf-8") as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line.startswith("#"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
parts = line.split(";")
|
||||||
|
if len(parts) == 5:
|
||||||
|
num, dtc_name, dtc_severity, title, description = [part.strip() for part in parts]
|
||||||
|
dtc_lines.append([int(num), dtc_name, dtc_severity, title, description])
|
||||||
|
|
||||||
|
# Überprüfen auf Duplikate in den DTC-Nummern und DTC-Namen
|
||||||
|
num_set = set()
|
||||||
|
dtc_name_set = set()
|
||||||
|
duplicates = []
|
||||||
|
|
||||||
|
for line in dtc_lines:
|
||||||
|
num, dtc_name, _, _, _ = line
|
||||||
|
if num in num_set:
|
||||||
|
duplicates.append(f"DTC-Nummer {num} ist ein Duplikat.")
|
||||||
|
else:
|
||||||
|
num_set.add(num)
|
||||||
|
|
||||||
|
if dtc_name in dtc_name_set:
|
||||||
|
duplicates.append(f"DTC-Name '{dtc_name}' ist ein Duplikat.")
|
||||||
|
else:
|
||||||
|
dtc_name_set.add(dtc_name)
|
||||||
|
|
||||||
|
if duplicates:
|
||||||
|
for duplicate in duplicates:
|
||||||
|
print(f"Fehler: {duplicate}")
|
||||||
|
raise ValueError("Duplicate DTC Data detected")
|
||||||
|
|
||||||
|
# Suchen nach DTC_NO_DTC und DTC_LAST_DTC
|
||||||
|
dtc_no_dtc_added = False
|
||||||
|
dtc_last_dtc_line = None
|
||||||
|
|
||||||
|
for line in dtc_lines:
|
||||||
|
_, dtc_name, _, _, _ = line
|
||||||
|
if dtc_name == "DTC_NO_DTC":
|
||||||
|
dtc_no_dtc_added = True
|
||||||
|
elif dtc_name == "DTC_LAST_DTC":
|
||||||
|
dtc_last_dtc_line = line
|
||||||
|
|
||||||
|
# Einen DTC für DTC_NO_DTC hinzufügen (wenn nicht vorhanden)
|
||||||
|
if not dtc_no_dtc_added:
|
||||||
|
dtc_lines.insert(0, [0, "DTC_NO_DTC", "DTC_NONE", "No Error", "No Error"])
|
||||||
|
|
||||||
|
# Falls DTC_LAST_DTC existiert, lösche es
|
||||||
|
if dtc_last_dtc_line:
|
||||||
|
dtc_lines.remove(dtc_last_dtc_line)
|
||||||
|
|
||||||
|
# Einen DTC für DTC_LAST_DTC hinzufügen (mit der höchsten Nummer)
|
||||||
|
if dtc_lines:
|
||||||
|
highest_num = max([line[0] for line in dtc_lines])
|
||||||
|
else:
|
||||||
|
highest_num = 0
|
||||||
|
|
||||||
|
dtc_lines.append([highest_num + 1, "DTC_LAST_DTC", "DTC_NONE", "Last Error", "Last Error"])
|
||||||
|
|
||||||
|
# Sortieren der Zeilen nach der Nummer aufsteigend
|
||||||
|
dtc_lines.sort(key=lambda x: x[0])
|
||||||
|
|
||||||
|
# DTC_NAME_CONSTANT-Makros initialisieren
|
||||||
|
dtc_macros = []
|
||||||
|
dtc_structs = []
|
||||||
|
dtc_table_data = []
|
||||||
|
|
||||||
|
# Verarbeiten der sortierten Zeilen
|
||||||
|
for i, line in enumerate(dtc_lines):
|
||||||
|
num, dtc_name, dtc_severity, title, description = line
|
||||||
|
dtc_macros.append(f"#define {dtc_name:<30} {num}")
|
||||||
|
comma = "," if i < len(dtc_lines) - 1 else " "
|
||||||
|
dtc_structs.append(f" {{ {dtc_name:<30}, {dtc_severity:<12} }}{comma} // {description}")
|
||||||
|
dtc_table_data.append({"num": num, "title": title, "description": description})
|
||||||
|
|
||||||
|
# Unix-Zeitstempel hinzufügen
|
||||||
|
timestamp = int(time.time())
|
||||||
|
|
||||||
|
# Headerdatei schreiben
|
||||||
|
with open(output_file, "w") as f:
|
||||||
|
f.write(f"// Auto-generated by script on {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp))}\n")
|
||||||
|
f.write(f"#ifndef DTC_DEFS_H\n")
|
||||||
|
f.write(f"#define DTC_DEFS_H\n\n")
|
||||||
|
f.write("#include <stdint.h>\n\n")
|
||||||
|
|
||||||
|
f.write("typedef uint32_t DTCNum_t;\n\n")
|
||||||
|
|
||||||
|
f.write("typedef enum\n")
|
||||||
|
f.write("{\n")
|
||||||
|
f.write(" DTC_INACTIVE,\n")
|
||||||
|
f.write(" DTC_ACTIVE,\n")
|
||||||
|
f.write(" DTC_PREVIOUS\n")
|
||||||
|
f.write("} DTCActive_t;\n\n")
|
||||||
|
|
||||||
|
f.write("typedef enum\n")
|
||||||
|
f.write("{\n")
|
||||||
|
f.write(" DTC_NONE,\n")
|
||||||
|
f.write(" DTC_INFO,\n")
|
||||||
|
f.write(" DTC_WARN,\n")
|
||||||
|
f.write(" DTC_CRITICAL\n")
|
||||||
|
f.write("} DTCSeverity_t;\n\n")
|
||||||
|
|
||||||
|
f.write("typedef struct {\n")
|
||||||
|
f.write(" DTCNum_t code;\n")
|
||||||
|
f.write(" DTCSeverity_t severity;\n")
|
||||||
|
f.write("} DTC_t;\n\n")
|
||||||
|
|
||||||
|
# Füge die DTC_NAME_CONSTANT #define hinzu
|
||||||
|
f.write("\n".join(dtc_macros) + "\n\n")
|
||||||
|
|
||||||
|
f.write(f"const DTC_t dtc_definitions[] = {{\n")
|
||||||
|
f.write(",\n".join(dtc_structs) + "\n")
|
||||||
|
f.write("};\n\n")
|
||||||
|
f.write(f"const uint32_t dtc_generation_timestamp = {timestamp};\n\n")
|
||||||
|
f.write("#endif // DTC_DEFS_H\n")
|
||||||
|
|
||||||
|
print(f"Header-Datei wurde erstellt: {output_file}")
|
||||||
|
|
||||||
|
# JSON-Datei mit UTF-8-Zeichencodierung erstellen
|
||||||
|
with open(json_output_file, 'w', encoding='utf-8') as json_f:
|
||||||
|
json.dump(dtc_table_data, json_f, ensure_ascii=False, indent=4, separators=(',', ': '))
|
||||||
|
|
||||||
|
print(f"JSON-Datei wurde erstellt: {json_output_file}")
|
@ -11,6 +11,7 @@
|
|||||||
<script src="static/js/jquery.min.js"></script>
|
<script src="static/js/jquery.min.js"></script>
|
||||||
<script src="static/js/bootstrap.min.js"></script>
|
<script src="static/js/bootstrap.min.js"></script>
|
||||||
<script src="static/js/websocket.js"></script>
|
<script src="static/js/websocket.js"></script>
|
||||||
|
<script src="static/js/dtc_table.js"></script>
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
|
||||||
@ -814,19 +815,27 @@
|
|||||||
var dtc = dtctr.data('dtc')
|
var dtc = dtctr.data('dtc')
|
||||||
var debugval = dtctr.data('debugval')
|
var debugval = dtctr.data('debugval')
|
||||||
var modal = $(this)
|
var modal = $(this)
|
||||||
$.getJSON('static/tt_dtc/dtc_' + dtc + '.json', function (data) {
|
|
||||||
modal.find('.modal-title').text(data.title)
|
getDescriptionForDTCNumber(dtc, function (error, title, description) {
|
||||||
modal.find('.dtc-desc').text(data.description)
|
if (error)
|
||||||
if (debugval > 0) {
|
{
|
||||||
modal.find('.dtc-debugval').text("Debugvalue: " + debugval)
|
console.error("Fehler beim Abrufen der Beschreibung:", error);
|
||||||
}
|
|
||||||
else {
|
|
||||||
modal.find('.dtc-debugval').remove()
|
|
||||||
}
|
|
||||||
}).fail(function () {
|
|
||||||
console.log("An error has occurred.");
|
|
||||||
modal.find('.modal-title').text("Fehler")
|
modal.find('.modal-title').text("Fehler")
|
||||||
modal.find('.dtc-desc').text("DTC-Beschreibung konnte nicht geladen werden")
|
modal.find('.dtc-desc').text("DTC-Beschreibung konnte nicht geladen werden")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modal.find('.modal-title').text(title)
|
||||||
|
modal.find('.dtc-desc').text(description)
|
||||||
|
if (debugval > 0)
|
||||||
|
{
|
||||||
|
modal.find('.dtc-debugval').text("Debugvalue: " + debugval)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modal.find('.dtc-debugval').remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
77
Software/data_src/static/dtc_table.json
Normal file
77
Software/data_src/static/dtc_table.json
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"num": 0,
|
||||||
|
"title": "No Error",
|
||||||
|
"description": "No Error"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 1,
|
||||||
|
"title": "Ölvorrat leer",
|
||||||
|
"description": "Ölvorrat ist komplett leer. Den Ölvorrat auffüllen und im Menu 'Wartung' zurück setzen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 2,
|
||||||
|
"title": "Ölvorrat niedrig",
|
||||||
|
"description": "Ölvorrat ist unter der Warnschwelle. Den Ölvorrat demnächst auffüllen und im Menu 'Wartung' zurück setzen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 3,
|
||||||
|
"title": "kein EEPROM erkannt",
|
||||||
|
"description": "Es wurde kein EEPROM gefunden. Dies lässt einen Hardware-Defekt vermuten."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 4,
|
||||||
|
"title": "EEPROM CFG Checksumme",
|
||||||
|
"description": "Die Checksumme der Config-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 5,
|
||||||
|
"title": "EEPROM PDS Checksumme",
|
||||||
|
"description": "Die Checksumme der Betriebsdaten-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 6,
|
||||||
|
"title": "EEPROM PDS Adresse",
|
||||||
|
"description": "Die Adresse der Betriebsdaten-Partition im EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 7,
|
||||||
|
"title": "EEPROM Version falsch",
|
||||||
|
"description": "Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version überein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 8,
|
||||||
|
"title": "Flashspeicher Fehler",
|
||||||
|
"description": "Der Flashspeicher konnte nicht initialisiert werden. Aktualisieren sie Flash & Firmware"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 9,
|
||||||
|
"title": "Flashversion falsch",
|
||||||
|
"description": "Die Version des Flashspeicher stimmt nicht mit der Firmware-Version überein. Aktualisieren sie den Flash mit der passenden Update-Datei"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 10,
|
||||||
|
"title": "Keine GPS-Verbindung",
|
||||||
|
"description": "Es wurde kein GPS-Signal über die serielle Schnittstelle empfangen, Prüfen sie die Verbindung und das GPS-Modul"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 11,
|
||||||
|
"title": "CAN-Transceiver Error",
|
||||||
|
"description": "Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Prüfen Sie die Hardware auf Defekte"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 12,
|
||||||
|
"title": "Keine CAN-Verbindung",
|
||||||
|
"description": "Es konnte kein CAN-Signal empfangen werden. Prüfen sie die Verbindung und die Einstellungen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 13,
|
||||||
|
"title": "Config-Validierung",
|
||||||
|
"description": "Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"num": 14,
|
||||||
|
"title": "Last Error",
|
||||||
|
"description": "Last Error"
|
||||||
|
}
|
||||||
|
]
|
23
Software/data_src/static/js/dtc_table.js
Normal file
23
Software/data_src/static/js/dtc_table.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
const jsonFilePath = "static/dtc_table.json";
|
||||||
|
|
||||||
|
function getDescriptionForDTCNumber(number, callback) {
|
||||||
|
fetch(jsonFilePath)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
const foundEntry = data.find((entry) => entry.num === number);
|
||||||
|
|
||||||
|
if (foundEntry) {
|
||||||
|
const description = foundEntry.description;
|
||||||
|
const title = foundEntry.title;
|
||||||
|
callback(null, title, description);
|
||||||
|
} else {
|
||||||
|
// Wenn die Nummer nicht gefunden wurde, geben Sie einen Fehler zurück
|
||||||
|
callback(`Beschreibung für Nummer ${number} nicht gefunden.`,null, null);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// Im Fehlerfall geben Sie den Fehler zurück
|
||||||
|
callback(error, null, null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Ölvorrat leer",
|
|
||||||
"description": "Ölvorrat ist komplett leer. Den Ölvorrat auffüllen und im Menu 'Wartung' zurück setzen"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Keine GPS-Verbindung",
|
|
||||||
"description": "Es wurde kein GPS-Signal über die serielle Schnittstelle empfangen, Prüfen sie die Verbindung und das GPS-Modul"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "CAN-Transceiver Error",
|
|
||||||
"description": "Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Prüfen Sie die Hardware auf Defekte"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Keine CAN-Verbindung",
|
|
||||||
"description": "Es konnte kein CAN-Signal empfangen werden. Prüfen sie die Verbindung und die Einstellungen"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Config-Validierung",
|
|
||||||
"description": "Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Ölvorrat niedrig",
|
|
||||||
"description": "Ölvorrat ist unter der Warnschwelle. Den Ölvorrat demnächst auffüllen und im Menu 'Wartung' zurück setzen"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "kein EEPROM gefunden",
|
|
||||||
"description": "Es wurde kein EEPROM gefunden. Dies lässt einen Hardware-Defekt vermuten."
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "EEPROM CFG Checksumme",
|
|
||||||
"description": "Die Checksumme der Config-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "EEPROM PDS Checksumme",
|
|
||||||
"description": "Die Checksumme der Betriebsdaten-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "EEPROM PDS Adresse",
|
|
||||||
"description": "Die Adresse der Betriebsdaten-Partition im EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "EEPROM Version falsch",
|
|
||||||
"description": "Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version überein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Flashstorage Fehler",
|
|
||||||
"description": "Der Flashstorage konnte nicht initialisiert werden. Aktualisieren sie Flash & Firmware"
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "Flashstorage Version falsch",
|
|
||||||
"description": "Die Version des Flashstorage stimmt nicht mit der Firmware-Version überein. Aktualisieren sie den Flash mit der passenden Update-Datei"
|
|
||||||
}
|
|
@ -2,56 +2,25 @@
|
|||||||
#define _DTC_H_
|
#define _DTC_H_
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include "dtc_defs.h"
|
||||||
|
|
||||||
#define MAX_DTC_STORAGE 6
|
#define MAX_DTC_STORAGE 6
|
||||||
|
|
||||||
typedef enum DTCNums_e
|
typedef struct
|
||||||
{
|
{
|
||||||
DTC_TANK_EMPTY = 1,
|
DTCNum_t Number;
|
||||||
DTC_TANK_LOW,
|
|
||||||
DTC_NO_EEPROM_FOUND,
|
|
||||||
DTC_EEPROM_CFG_BAD,
|
|
||||||
DTC_EEPROM_PDS_BAD,
|
|
||||||
DTC_EEPROM_PDSADRESS_BAD,
|
|
||||||
DTC_EEPROM_VERSION_BAD,
|
|
||||||
DTC_FLASHFS_ERROR,
|
|
||||||
DTC_FLASHFS_VERSION_ERROR,
|
|
||||||
DTC_NO_GPS_SERIAL,
|
|
||||||
DTC_CAN_TRANSCEIVER_FAILED,
|
|
||||||
DTC_NO_CAN_SIGNAL,
|
|
||||||
DTC_EEPROM_CFG_SANITY,
|
|
||||||
DTC_LAST_DTC
|
|
||||||
} DTCNums_t;
|
|
||||||
|
|
||||||
typedef enum DTCActive_e
|
|
||||||
{
|
|
||||||
DTC_NONE,
|
|
||||||
DTC_ACTIVE,
|
|
||||||
DTC_PREVIOUS
|
|
||||||
} DTCActive_t;
|
|
||||||
|
|
||||||
typedef enum DTCSeverity_e
|
|
||||||
{
|
|
||||||
DTC_INFO,
|
|
||||||
DTC_WARN,
|
|
||||||
DTC_CRITICAL
|
|
||||||
} DTCSeverity_t;
|
|
||||||
|
|
||||||
typedef struct DTCEntry_s
|
|
||||||
{
|
|
||||||
DTCNums_t Number;
|
|
||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
DTCActive_t active;
|
DTCActive_t active;
|
||||||
DTCSeverity_t severity;
|
|
||||||
uint32_t debugVal;
|
uint32_t debugVal;
|
||||||
} DTCEntry_t;
|
} DTCEntry_t;
|
||||||
|
|
||||||
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue = 0);
|
void MaintainDTC(DTCNum_t DTC_no, boolean active, uint32_t DebugValue = 0);
|
||||||
void ClearDTC(DTCNums_t DTC_no);
|
void ClearDTC(DTCNum_t DTC_no);
|
||||||
void ClearAllDTC();
|
void ClearAllDTC();
|
||||||
DTCNums_t getlastDTC(boolean only_active);
|
DTCNum_t getlastDTC(boolean only_active);
|
||||||
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
|
DTCNum_t ActiveDTCseverity(DTCSeverity_t severity);
|
||||||
|
DTCSeverity_t getSeverityForDTC(DTCNum_t targetCode);
|
||||||
void DTC_Process();
|
void DTC_Process();
|
||||||
|
|
||||||
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
extern DTCEntry_t DTCStorage[MAX_DTC_STORAGE];
|
||||||
#endif
|
#endif
|
65
Software/include/dtc_defs.h
Normal file
65
Software/include/dtc_defs.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
// Auto-generated by script on 2023-09-27 19:05:49
|
||||||
|
#ifndef DTC_DEFS_H
|
||||||
|
#define DTC_DEFS_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef uint32_t DTCNum_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DTC_INACTIVE,
|
||||||
|
DTC_ACTIVE,
|
||||||
|
DTC_PREVIOUS
|
||||||
|
} DTCActive_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DTC_NONE,
|
||||||
|
DTC_INFO,
|
||||||
|
DTC_WARN,
|
||||||
|
DTC_CRITICAL
|
||||||
|
} DTCSeverity_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
DTCNum_t code;
|
||||||
|
DTCSeverity_t severity;
|
||||||
|
} DTC_t;
|
||||||
|
|
||||||
|
#define DTC_NO_DTC 0
|
||||||
|
#define DTC_TANK_EMPTY 1
|
||||||
|
#define DTC_TANK_LOW 2
|
||||||
|
#define DTC_NO_EEPROM_FOUND 3
|
||||||
|
#define DTC_EEPROM_CFG_BAD 4
|
||||||
|
#define DTC_EEPROM_PDS_BAD 5
|
||||||
|
#define DTC_EEPROM_PDSADRESS_BAD 6
|
||||||
|
#define DTC_EEPROM_VERSION_BAD 7
|
||||||
|
#define DTC_FLASHFS_ERROR 8
|
||||||
|
#define DTC_FLASHFS_VERSION_ERROR 9
|
||||||
|
#define DTC_NO_GPS_SERIAL 10
|
||||||
|
#define DTC_CAN_TRANSCEIVER_FAILED 11
|
||||||
|
#define DTC_NO_CAN_SIGNAL 12
|
||||||
|
#define DTC_EEPROM_CFG_SANITY 13
|
||||||
|
#define DTC_LAST_DTC 14
|
||||||
|
|
||||||
|
const DTC_t dtc_definitions[] = {
|
||||||
|
{ DTC_NO_DTC , DTC_NONE }, // No Error,
|
||||||
|
{ DTC_TANK_EMPTY , DTC_CRITICAL }, // Ölvorrat ist komplett leer. Den Ölvorrat auffüllen und im Menu 'Wartung' zurück setzen,
|
||||||
|
{ DTC_TANK_LOW , DTC_WARN }, // Ölvorrat ist unter der Warnschwelle. Den Ölvorrat demnächst auffüllen und im Menu 'Wartung' zurück setzen,
|
||||||
|
{ DTC_NO_EEPROM_FOUND , DTC_CRITICAL }, // Es wurde kein EEPROM gefunden. Dies lässt einen Hardware-Defekt vermuten.,
|
||||||
|
{ DTC_EEPROM_CFG_BAD , DTC_CRITICAL }, // Die Checksumme der Config-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück,
|
||||||
|
{ DTC_EEPROM_PDS_BAD , DTC_CRITICAL }, // Die Checksumme der Betriebsdaten-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück,
|
||||||
|
{ DTC_EEPROM_PDSADRESS_BAD , DTC_CRITICAL }, // Die Adresse der Betriebsdaten-Partition im EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück,
|
||||||
|
{ DTC_EEPROM_VERSION_BAD , DTC_CRITICAL }, // Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version überein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück,
|
||||||
|
{ DTC_FLASHFS_ERROR , DTC_CRITICAL }, // Der Flashspeicher konnte nicht initialisiert werden. Aktualisieren sie Flash & Firmware,
|
||||||
|
{ DTC_FLASHFS_VERSION_ERROR , DTC_CRITICAL }, // Die Version des Flashspeicher stimmt nicht mit der Firmware-Version überein. Aktualisieren sie den Flash mit der passenden Update-Datei,
|
||||||
|
{ DTC_NO_GPS_SERIAL , DTC_CRITICAL }, // Es wurde kein GPS-Signal über die serielle Schnittstelle empfangen, Prüfen sie die Verbindung und das GPS-Modul,
|
||||||
|
{ DTC_CAN_TRANSCEIVER_FAILED , DTC_CRITICAL }, // Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Prüfen Sie die Hardware auf Defekte,
|
||||||
|
{ DTC_NO_CAN_SIGNAL , DTC_WARN }, // Es konnte kein CAN-Signal empfangen werden. Prüfen sie die Verbindung und die Einstellungen,
|
||||||
|
{ DTC_EEPROM_CFG_SANITY , DTC_WARN }, // Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen,
|
||||||
|
{ DTC_LAST_DTC , DTC_NONE } // Last Error
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint32_t dtc_generation_timestamp = 1695834349;
|
||||||
|
|
||||||
|
#endif // DTC_DEFS_H
|
@ -30,6 +30,7 @@ build_flags =
|
|||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
post:prepare_littlefs.py
|
post:prepare_littlefs.py
|
||||||
|
pre:build_dtcs.py
|
||||||
pre:prepare_fwfiles.py
|
pre:prepare_fwfiles.py
|
||||||
|
|
||||||
monitor_filters = esp8266_exception_decoder
|
monitor_filters = esp8266_exception_decoder
|
||||||
|
@ -10,7 +10,7 @@ void Init_CAN()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) != CAN_OK)
|
if (CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) != CAN_OK)
|
||||||
MaintainDTC(DTC_CAN_TRANSCEIVER_FAILED, DTC_CRITICAL, true);
|
MaintainDTC(DTC_CAN_TRANSCEIVER_FAILED, true);
|
||||||
|
|
||||||
CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask...
|
CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask...
|
||||||
CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask...
|
CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask...
|
||||||
@ -55,7 +55,7 @@ uint32_t Process_CAN_WheelSpeed()
|
|||||||
|
|
||||||
if (lastRecTimestamp > 1000)
|
if (lastRecTimestamp > 1000)
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_NO_CAN_SIGNAL, DTC_CRITICAL, (millis() > lastRecTimestamp + 10000 ? true : false));
|
MaintainDTC(DTC_NO_CAN_SIGNAL, (millis() > lastRecTimestamp + 10000 ? true : false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return milimeters_to_add;
|
return milimeters_to_add;
|
||||||
|
@ -83,6 +83,12 @@ void StoreConfig_EEPROM()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ee.updateBlock(startofLubeConfig, (uint8_t *)&LubeConfig, sizeof(LubeConfig));
|
ee.updateBlock(startofLubeConfig, (uint8_t *)&LubeConfig, sizeof(LubeConfig));
|
||||||
|
|
||||||
|
uint32_t ConfigSanityCheckResult = ConfigSanityCheck(false);
|
||||||
|
if (ConfigSanityCheckResult > 0)
|
||||||
|
{
|
||||||
|
MaintainDTC(DTC_EEPROM_CFG_SANITY, true, ConfigSanityCheckResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetConfig_EEPROM()
|
void GetConfig_EEPROM()
|
||||||
@ -97,16 +103,14 @@ void GetConfig_EEPROM()
|
|||||||
|
|
||||||
if (Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig)) != checksum)
|
if (Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig)) != checksum)
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_EEPROM_CFG_BAD, DTC_CRITICAL, true);
|
MaintainDTC(DTC_EEPROM_CFG_BAD, true);
|
||||||
}
|
}
|
||||||
LubeConfig.checksum = checksum;
|
LubeConfig.checksum = checksum;
|
||||||
|
|
||||||
uint32_t ConfigSanityCheckResult = ConfigSanityCheck(false);
|
uint32_t ConfigSanityCheckResult = ConfigSanityCheck(false);
|
||||||
|
|
||||||
if (ConfigSanityCheckResult > 0)
|
if (ConfigSanityCheckResult > 0)
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_EEPROM_CFG_SANITY, DTC_WARN, true, ConfigSanityCheckResult);
|
MaintainDTC(DTC_EEPROM_CFG_SANITY, true, ConfigSanityCheckResult);
|
||||||
globals.requestEEAction = EE_CFG_SAVE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +142,7 @@ void GetPersistence_EEPROM()
|
|||||||
{
|
{
|
||||||
MovePersistencePage_EEPROM(true);
|
MovePersistencePage_EEPROM(true);
|
||||||
FormatPersistence_EEPROM();
|
FormatPersistence_EEPROM();
|
||||||
MaintainDTC(DTC_EEPROM_PDSADRESS_BAD, DTC_CRITICAL, true);
|
MaintainDTC(DTC_EEPROM_PDSADRESS_BAD, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -149,7 +153,7 @@ void GetPersistence_EEPROM()
|
|||||||
|
|
||||||
if (Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData)) != checksum)
|
if (Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData)) != checksum)
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_EEPROM_PDS_BAD, DTC_CRITICAL, true);
|
MaintainDTC(DTC_EEPROM_PDS_BAD, true);
|
||||||
}
|
}
|
||||||
PersistenceData.checksum = checksum;
|
PersistenceData.checksum = checksum;
|
||||||
}
|
}
|
||||||
@ -245,10 +249,10 @@ boolean checkEEPROMavailable()
|
|||||||
{
|
{
|
||||||
if (!ee.isConnected())
|
if (!ee.isConnected())
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, true);
|
MaintainDTC(DTC_NO_EEPROM_FOUND, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, false);
|
MaintainDTC(DTC_NO_EEPROM_FOUND, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ void Debug_ShowDTCs()
|
|||||||
else
|
else
|
||||||
strcpy(buff_active, "none");
|
strcpy(buff_active, "none");
|
||||||
|
|
||||||
Debug_pushMessage("%s %7d %8s %8d\n", buff_timestamp, DTCStorage[i].Number, buff_active, DTCStorage[i].severity);
|
Debug_pushMessage("%s %7d %8s %8d\n", buff_timestamp, DTCStorage[i].Number, buff_active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "dtc.h"
|
#include "dtc.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
|
|
||||||
DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
DTCEntry_t DTCStorage[MAX_DTC_STORAGE];
|
||||||
|
|
||||||
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue)
|
void MaintainDTC(DTCNum_t DTC_no, boolean active, uint32_t DebugValue)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
||||||
{
|
{
|
||||||
@ -14,7 +14,6 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, u
|
|||||||
Debug_pushMessage("DTC gone active: %d, DebugVal: %d\n", DTC_no, DebugValue);
|
Debug_pushMessage("DTC gone active: %d, DebugVal: %d\n", DTC_no, DebugValue);
|
||||||
DTCStorage[i].timestamp = millis();
|
DTCStorage[i].timestamp = millis();
|
||||||
DTCStorage[i].active = DTC_ACTIVE;
|
DTCStorage[i].active = DTC_ACTIVE;
|
||||||
DTCStorage[i].severity = DTC_severity;
|
|
||||||
DTCStorage[i].debugVal = DebugValue;
|
DTCStorage[i].debugVal = DebugValue;
|
||||||
}
|
}
|
||||||
if (!active && DTCStorage[i].active == DTC_ACTIVE)
|
if (!active && DTCStorage[i].active == DTC_ACTIVE)
|
||||||
@ -39,21 +38,20 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, u
|
|||||||
DTCStorage[i].timestamp = millis();
|
DTCStorage[i].timestamp = millis();
|
||||||
DTCStorage[i].active = DTC_ACTIVE;
|
DTCStorage[i].active = DTC_ACTIVE;
|
||||||
DTCStorage[i].debugVal = DebugValue;
|
DTCStorage[i].debugVal = DebugValue;
|
||||||
DTCStorage[i].severity = DTC_severity;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearDTC(DTCNums_t DTC_no)
|
void ClearDTC(DTCNum_t DTC_no)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
||||||
{
|
{
|
||||||
if (DTCStorage[i].Number == DTC_no)
|
if (DTCStorage[i].Number == DTC_no)
|
||||||
{
|
{
|
||||||
DTCStorage[i].Number = DTC_LAST_DTC;
|
DTCStorage[i].Number = DTC_LAST_DTC;
|
||||||
DTCStorage[i].active = DTC_NONE;
|
DTCStorage[i].active = DTC_INACTIVE;
|
||||||
DTCStorage[i].timestamp = 0;
|
DTCStorage[i].timestamp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,12 +62,12 @@ void ClearAllDTC()
|
|||||||
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
||||||
{
|
{
|
||||||
DTCStorage[i].Number = DTC_LAST_DTC;
|
DTCStorage[i].Number = DTC_LAST_DTC;
|
||||||
DTCStorage[i].active = DTC_NONE;
|
DTCStorage[i].active = DTC_INACTIVE;
|
||||||
DTCStorage[i].timestamp = 0;
|
DTCStorage[i].timestamp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DTCNums_t getlastDTC(boolean only_active)
|
DTCNum_t getlastDTC(boolean only_active)
|
||||||
{
|
{
|
||||||
int8_t pointer = -1;
|
int8_t pointer = -1;
|
||||||
uint32_t lasttimestamp = 0;
|
uint32_t lasttimestamp = 0;
|
||||||
@ -89,34 +87,28 @@ DTCNums_t getlastDTC(boolean only_active)
|
|||||||
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
|
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
|
||||||
}
|
}
|
||||||
|
|
||||||
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity)
|
DTCSeverity_t getSeverityForDTC(DTCNum_t targetCode)
|
||||||
{
|
{
|
||||||
int8_t pointer = -1;
|
for (int i = 0; i < DTC_LAST_DTC; i++)
|
||||||
uint32_t lasttimestamp = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
|
||||||
{
|
{
|
||||||
if (DTCStorage[i].Number > 0 && DTCStorage[i].timestamp > lasttimestamp)
|
if (dtc_definitions[i].code == targetCode)
|
||||||
{
|
{
|
||||||
if ((only_active == false || DTCStorage[i].active == DTC_ACTIVE) && DTCStorage[i].severity == severity)
|
return dtc_definitions[i].severity;
|
||||||
{
|
|
||||||
pointer = i;
|
|
||||||
lasttimestamp = DTCStorage[i].timestamp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return DTC_NONE;
|
||||||
|
|
||||||
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DTC_Process()
|
void DTC_Process()
|
||||||
{
|
{
|
||||||
static tSystem_Status preserverSysStatusError;
|
static tSystem_Status preserverSysStatusError;
|
||||||
|
DTCNum_t lastDTC = getlastDTC(true);
|
||||||
|
|
||||||
if (getlastDTC(false) < DTC_LAST_DTC)
|
if (lastDTC < DTC_LAST_DTC)
|
||||||
{
|
{
|
||||||
globals.hasDTC = true;
|
globals.hasDTC = true;
|
||||||
if (getlastDTC_Severity(true, DTC_CRITICAL) < DTC_LAST_DTC && globals.systemStatus != sysStat_Shutdown)
|
|
||||||
|
if (getSeverityForDTC(lastDTC) == DTC_CRITICAL && globals.systemStatus != sysStat_Shutdown)
|
||||||
{
|
{
|
||||||
if (globals.systemStatus != sysStat_Error)
|
if (globals.systemStatus != sysStat_Error)
|
||||||
{
|
{
|
||||||
@ -124,16 +116,14 @@ void DTC_Process()
|
|||||||
}
|
}
|
||||||
globals.systemStatus = sysStat_Error;
|
globals.systemStatus = sysStat_Error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
globals.hasDTC = false;
|
||||||
|
|
||||||
if (globals.systemStatus == sysStat_Error)
|
if (globals.systemStatus == sysStat_Error)
|
||||||
{
|
{
|
||||||
globals.systemStatus = preserverSysStatusError;
|
globals.systemStatus = preserverSysStatusError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
globals.hasDTC = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
16
Software/src/dtc_defs.txt
Normal file
16
Software/src/dtc_defs.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# No. | DTC-Constant | Severity | Title | Description
|
||||||
|
#-----|------------------------------|---------------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
1; DTC_TANK_EMPTY; DTC_CRITICAL; Ölvorrat leer; Ölvorrat ist komplett leer. Den Ölvorrat auffüllen und im Menu 'Wartung' zurück setzen
|
||||||
|
2; DTC_TANK_LOW; DTC_WARN; Ölvorrat niedrig; Ölvorrat ist unter der Warnschwelle. Den Ölvorrat demnächst auffüllen und im Menu 'Wartung' zurück setzen
|
||||||
|
3; DTC_NO_EEPROM_FOUND; DTC_CRITICAL; kein EEPROM erkannt; Es wurde kein EEPROM gefunden. Dies lässt einen Hardware-Defekt vermuten.
|
||||||
|
4; DTC_EEPROM_CFG_BAD; DTC_CRITICAL; EEPROM CFG Checksumme; Die Checksumme der Config-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück
|
||||||
|
5; DTC_EEPROM_PDS_BAD; DTC_CRITICAL; EEPROM PDS Checksumme; Die Checksumme der Betriebsdaten-Partition des EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück
|
||||||
|
6; DTC_EEPROM_PDSADRESS_BAD; DTC_CRITICAL; EEPROM PDS Adresse; Die Adresse der Betriebsdaten-Partition im EEPROM ist ungültig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zurück
|
||||||
|
7; DTC_EEPROM_VERSION_BAD; DTC_CRITICAL; EEPROM Version falsch; Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version überein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zurück
|
||||||
|
8; DTC_FLASHFS_ERROR; DTC_CRITICAL; Flashspeicher Fehler; Der Flashspeicher konnte nicht initialisiert werden. Aktualisieren sie Flash & Firmware
|
||||||
|
9; DTC_FLASHFS_VERSION_ERROR; DTC_CRITICAL; Flashversion falsch; Die Version des Flashspeicher stimmt nicht mit der Firmware-Version überein. Aktualisieren sie den Flash mit der passenden Update-Datei
|
||||||
|
10; DTC_NO_GPS_SERIAL; DTC_CRITICAL; Keine GPS-Verbindung; Es wurde kein GPS-Signal über die serielle Schnittstelle empfangen, Prüfen sie die Verbindung und das GPS-Modul
|
||||||
|
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
|
||||||
|
|
@ -7,8 +7,8 @@ void RunLubeApp(uint32_t add_milimeters)
|
|||||||
|
|
||||||
globals.TankPercentage = PersistenceData.tankRemain_microL / (LubeConfig.tankCapacity_ml * 10);
|
globals.TankPercentage = PersistenceData.tankRemain_microL / (LubeConfig.tankCapacity_ml * 10);
|
||||||
|
|
||||||
MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_microL < LubeConfig.amountPerDose_microL));
|
MaintainDTC(DTC_TANK_EMPTY, (PersistenceData.tankRemain_microL < LubeConfig.amountPerDose_microL));
|
||||||
MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage));
|
MaintainDTC(DTC_TANK_LOW, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage));
|
||||||
|
|
||||||
// Add traveled Distance in mm
|
// Add traveled Distance in mm
|
||||||
PersistenceData.TravelDistance_highRes_mm += add_milimeters;
|
PersistenceData.TravelDistance_highRes_mm += add_milimeters;
|
||||||
|
@ -19,6 +19,7 @@ AsyncWebSocket webSocket("/ws");
|
|||||||
|
|
||||||
void WebsocketEvent_Callback(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len);
|
void WebsocketEvent_Callback(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len);
|
||||||
void Websocket_HandleMessage(void *arg, uint8_t *data, size_t len);
|
void Websocket_HandleMessage(void *arg, uint8_t *data, size_t len);
|
||||||
|
void Websocket_RefreshClientData_DTCs();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ void initWebUI()
|
|||||||
if (!LittleFS.begin())
|
if (!LittleFS.begin())
|
||||||
{
|
{
|
||||||
Debug_pushMessage("An Error has occurred while mounting LittleFS\n");
|
Debug_pushMessage("An Error has occurred while mounting LittleFS\n");
|
||||||
MaintainDTC(DTC_FLASHFS_ERROR, DTC_CRITICAL, true);
|
MaintainDTC(DTC_FLASHFS_ERROR, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ void initWebUI()
|
|||||||
snprintf(buffer, sizeof(buffer), "%d.%02d", constants.Required_Flash_Version_major, constants.Required_Flash_Version_minor);
|
snprintf(buffer, sizeof(buffer), "%d.%02d", constants.Required_Flash_Version_major, constants.Required_Flash_Version_minor);
|
||||||
if (strcmp(globals.FlashVersion, buffer))
|
if (strcmp(globals.FlashVersion, buffer))
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_FLASHFS_VERSION_ERROR, DTC_WARN, true);
|
MaintainDTC(DTC_FLASHFS_VERSION_ERROR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MDNS.begin(globals.DeviceName);
|
MDNS.begin(globals.DeviceName);
|
||||||
@ -183,7 +184,7 @@ String processor(const String &var)
|
|||||||
temp = temp + " data-debugval=" + String(DTCStorage[i].debugVal) + "><td>" + String(buff_timestamp);
|
temp = temp + " data-debugval=" + String(DTCStorage[i].debugVal) + "><td>" + String(buff_timestamp);
|
||||||
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
||||||
temp = temp + "<img src=static/img/";
|
temp = temp + "<img src=static/img/";
|
||||||
switch (DTCStorage[i].severity)
|
switch (getSeverityForDTC(DTCStorage[i].Number))
|
||||||
{
|
{
|
||||||
case DTC_CRITICAL:
|
case DTC_CRITICAL:
|
||||||
temp = temp + "critical";
|
temp = temp + "critical";
|
||||||
@ -194,6 +195,9 @@ String processor(const String &var)
|
|||||||
case DTC_INFO:
|
case DTC_INFO:
|
||||||
temp = temp + "info";
|
temp = temp + "info";
|
||||||
break;
|
break;
|
||||||
|
case DTC_NONE:
|
||||||
|
temp = temp + "none";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
temp = temp + ".png></td><td>";
|
temp = temp + ".png></td><td>";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user