Compare commits
	
		
			11 Commits
		
	
	
		
			744f8c431c
			...
			2138f640ee
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2138f640ee | |||
| d593e40f38 | |||
| 3bb9bf694e | |||
| f320fb1ca6 | |||
| b775738e20 | |||
| c42de4b24c | |||
| ce9f1a2306 | |||
| e1770527ab | |||
| aff1d40297 | |||
| caff1c185f | |||
| bea78c0020 | 
							
								
								
									
										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"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -7,6 +7,7 @@
 | 
				
			|||||||
#include "common.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "globals.h"
 | 
					#include "globals.h"
 | 
				
			||||||
#include "dtc.h"
 | 
					#include "dtc.h"
 | 
				
			||||||
 | 
					#include "debugger.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct can_frame
 | 
					struct can_frame
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -16,6 +17,7 @@ struct can_frame
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Init_CAN();
 | 
					void Init_CAN();
 | 
				
			||||||
 | 
					void CAN_Process();
 | 
				
			||||||
uint32_t Process_CAN_WheelSpeed();
 | 
					uint32_t Process_CAN_WheelSpeed();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -3,6 +3,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define Q(x) #x
 | 
					#define Q(x) #x
 | 
				
			||||||
#define QUOTE(x) Q(x)
 | 
					#define QUOTE(x) Q(x)
 | 
				
			||||||
 | 
					#define SET_BIT(value, bitPosition) ((value) |= (1U << (bitPosition)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if PCB_REV == 1
 | 
					#if PCB_REV == 1
 | 
				
			||||||
    #define GPIO_BUTTON D7
 | 
					    #define GPIO_BUTTON D7
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,7 +64,7 @@ typedef enum CANSource_e
 | 
				
			|||||||
const char CANSourceString[][28] = {
 | 
					const char CANSourceString[][28] = {
 | 
				
			||||||
    "KTM 890 Adventure R (2021)"};
 | 
					    "KTM 890 Adventure R (2021)"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
 | 
					const size_t CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
 | 
					const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,60 +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,
 | 
					 | 
				
			||||||
#ifdef FEATURE_ENABLE_GPS
 | 
					 | 
				
			||||||
  DTC_NO_GPS_SERIAL,
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#ifdef FEATURE_ENABLE_CAN
 | 
					 | 
				
			||||||
  DTC_CAN_TRANSCEIVER_FAILED,
 | 
					 | 
				
			||||||
  DTC_NO_CAN_SIGNAL,
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  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 }, // <20>lvorrat ist komplett leer. Den <20>lvorrat auff<66>llen und im Menu 'Wartung' zur<75>ck setzen,
 | 
				
			||||||
 | 
					    { DTC_TANK_LOW                  , DTC_WARN     }, // <20>lvorrat ist unter der Warnschwelle. Den <20>lvorrat demn<6D>chst auff<66>llen und im Menu 'Wartung' zur<75>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<6E>ltig. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zur<75>ck,
 | 
				
			||||||
 | 
					    { DTC_EEPROM_PDS_BAD            , DTC_CRITICAL }, // Die Checksumme der Betriebsdaten-Partition des EEPROM ist ung<6E>ltig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zur<75>ck,
 | 
				
			||||||
 | 
					    { DTC_EEPROM_PDSADRESS_BAD      , DTC_CRITICAL }, // Die Adresse der Betriebsdaten-Partition im EEPROM ist ung<6E>ltig. Setzen sie den EEPROM-Bereich 'PDS' im Menu 'Wartung' zur<75>ck,
 | 
				
			||||||
 | 
					    { DTC_EEPROM_VERSION_BAD        , DTC_CRITICAL }, // Die Layout-Version des EEPROM stimmt nicht mit der Firmware-Version <20>berein. Setzen sie den EEPROM-Bereich 'CFG' im Menu 'Wartung' zur<75>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 <20>berein. Aktualisieren sie den Flash mit der passenden Update-Datei,
 | 
				
			||||||
 | 
					    { DTC_NO_GPS_SERIAL             , DTC_CRITICAL }, // Es wurde kein GPS-Signal <20>ber die serielle Schnittstelle empfangen, Pr<50>fen sie die Verbindung und das GPS-Modul,
 | 
				
			||||||
 | 
					    { DTC_CAN_TRANSCEIVER_FAILED    , DTC_CRITICAL }, // Es konnte keine Verbindung zum CAN-Transceiver hergestellt werden. Pr<50>fen Sie die Hardware auf Defekte,
 | 
				
			||||||
 | 
					    { DTC_NO_CAN_SIGNAL             , DTC_WARN     }, // Es konnte kein CAN-Signal empfangen werden. Pr<50>fen sie die Verbindung und die Einstellungen,
 | 
				
			||||||
 | 
					    { DTC_EEPROM_CFG_SANITY         , DTC_WARN     }, // Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Pr<50>fen Sie Ihre Einstellungen,
 | 
				
			||||||
 | 
					    { DTC_LAST_DTC                  , DTC_NONE     }  // Last Error
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const uint32_t dtc_generation_timestamp = 1695834349;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // DTC_DEFS_H
 | 
				
			||||||
@@ -7,6 +7,7 @@
 | 
				
			|||||||
#include "common.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "globals.h"
 | 
					#include "globals.h"
 | 
				
			||||||
#include "dtc.h"
 | 
					#include "dtc.h"
 | 
				
			||||||
 | 
					#include "debugger.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RunLubeApp(uint32_t add_milimeters);
 | 
					void RunLubeApp(uint32_t add_milimeters);
 | 
				
			||||||
void LubePulse();
 | 
					void LubePulse();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,12 @@
 | 
				
			|||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef CAN_DEBUG_MESSAGE
 | 
				
			||||||
 | 
					    #ifndef FEATURE_ENABLE_CAN
 | 
				
			||||||
 | 
					        #error "You cannot enable CAN-Debug-Message without FEATURE_ENABLE_CAN"
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef ADMIN_PASSWORD
 | 
					#ifndef ADMIN_PASSWORD
 | 
				
			||||||
    #error "You need to define ADMIN_PASSWORD for OTA-Update"
 | 
					    #error "You need to define ADMIN_PASSWORD for OTA-Update"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,19 +11,13 @@
 | 
				
			|||||||
[platformio]
 | 
					[platformio]
 | 
				
			||||||
extra_configs =
 | 
					extra_configs =
 | 
				
			||||||
  wifi_credentials.ini
 | 
					  wifi_credentials.ini
 | 
				
			||||||
 | 
					default_envs = pcb_rev_1-3, pcb_rev_1-2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[env:d1_mini]
 | 
					[env]
 | 
				
			||||||
platform = espressif8266
 | 
					platform = espressif8266
 | 
				
			||||||
board = d1_mini
 | 
					board = d1_mini
 | 
				
			||||||
framework = arduino
 | 
					framework = arduino
 | 
				
			||||||
 | 
					
 | 
				
			||||||
upload_protocol = esptool
 | 
					 | 
				
			||||||
upload_speed = 921600
 | 
					 | 
				
			||||||
;upload_port = ChainLube_DDEFB2
 | 
					 | 
				
			||||||
;upload_protocol = espota
 | 
					 | 
				
			||||||
;upload_flags =  
 | 
					 | 
				
			||||||
;    --auth=${wifi_cred.admin_password}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
build_flags =
 | 
					build_flags =
 | 
				
			||||||
  !python git_rev_macro.py
 | 
					  !python git_rev_macro.py
 | 
				
			||||||
  -DWIFI_SSID_CLIENT=${wifi_cred.wifi_ssid_client}
 | 
					  -DWIFI_SSID_CLIENT=${wifi_cred.wifi_ssid_client}
 | 
				
			||||||
@@ -32,31 +26,58 @@ build_flags =
 | 
				
			|||||||
  -DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
 | 
					  -DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
 | 
				
			||||||
  -DWIFI_AP_IP_GW=10,0,0,1
 | 
					  -DWIFI_AP_IP_GW=10,0,0,1
 | 
				
			||||||
  -DATOMIC_FS_UPDATE
 | 
					  -DATOMIC_FS_UPDATE
 | 
				
			||||||
  ;-DFEATURE_ENABLE_WIFI_CLIENT
 | 
					 | 
				
			||||||
  -DFEATURE_ENABLE_OLED
 | 
					 | 
				
			||||||
  ;-DFEATURE_ENABLE_TIMER
 | 
					 | 
				
			||||||
  -DFEATURE_ENABLE_CAN
 | 
					 | 
				
			||||||
  ;-DFEATURE_ENABLE_GPS
 | 
					 | 
				
			||||||
  -DFEATURE_ENABLE_WEBSOCKETS
 | 
					 | 
				
			||||||
  -DPCB_REV=3
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;build_type = debug
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
board_build.filesystem = littlefs
 | 
					board_build.filesystem = littlefs
 | 
				
			||||||
extra_scripts = post:prepare_littlefs.py
 | 
					extra_scripts = 
 | 
				
			||||||
 | 
					  post:prepare_littlefs.py
 | 
				
			||||||
 | 
					  pre:build_dtcs.py
 | 
				
			||||||
 | 
					  pre:prepare_fwfiles.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
monitor_filters = esp8266_exception_decoder
 | 
					monitor_filters = esp8266_exception_decoder
 | 
				
			||||||
monitor_speed = 115200
 | 
					monitor_speed = 115200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
board_build.ldscript = eagle.flash.4m1m.ld
 | 
					 | 
				
			||||||
lib_ldf_mode = deep
 | 
					lib_ldf_mode = deep
 | 
				
			||||||
lib_deps = 
 | 
					lib_deps = 
 | 
				
			||||||
    olikraus/U8g2 @ ^2.28.8
 | 
					    olikraus/U8g2 @ ^2.28.8
 | 
				
			||||||
    adafruit/Adafruit NeoPixel @ ^1.11.0
 | 
					    adafruit/Adafruit NeoPixel @ ^1.11.0
 | 
				
			||||||
    ;https://github.com/FastLED/FastLED.git#3d2ab78 ;fastled/FastLED @ ^3.5.0
 | 
					 | 
				
			||||||
    sstaub/Ticker @ ^4.2.0
 | 
					    sstaub/Ticker @ ^4.2.0
 | 
				
			||||||
    coryjfowler/mcp_can @ ^1.5.0
 | 
					 | 
				
			||||||
    robtillaart/I2C_EEPROM @ ^1.5.2
 | 
					    robtillaart/I2C_EEPROM @ ^1.5.2
 | 
				
			||||||
    mikalhart/TinyGPSPlus @ ^1.0.3
 | 
					 | 
				
			||||||
    me-no-dev/ESP Async WebServer @ ^1.2.3
 | 
					    me-no-dev/ESP Async WebServer @ ^1.2.3
 | 
				
			||||||
    bblanchon/ArduinoJson @ ^6.19.4
 | 
					    bblanchon/ArduinoJson @ ^6.19.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[env:pcb_rev_1-3]
 | 
				
			||||||
 | 
					;build_type = debug
 | 
				
			||||||
 | 
					custom_pcb_revision = 3
 | 
				
			||||||
 | 
					build_flags =
 | 
				
			||||||
 | 
					  ${env.build_flags}
 | 
				
			||||||
 | 
					  ;-DFEATURE_ENABLE_WIFI_CLIENT
 | 
				
			||||||
 | 
					  ;-DFEATURE_ENABLE_TIMER
 | 
				
			||||||
 | 
					  ;-DFEATURE_ENABLE_GPS
 | 
				
			||||||
 | 
					  -DFEATURE_ENABLE_OLED
 | 
				
			||||||
 | 
					  -DFEATURE_ENABLE_WEBSOCKETS
 | 
				
			||||||
 | 
					  -DFEATURE_ENABLE_CAN
 | 
				
			||||||
 | 
					  -DCAN_DEBUG_MESSAGE
 | 
				
			||||||
 | 
					  -DPCB_REV=${this.custom_pcb_revision}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					board_build.ldscript = eagle.flash.4m1m.ld
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					lib_deps = 
 | 
				
			||||||
 | 
					    ${env.lib_deps}
 | 
				
			||||||
 | 
					    coryjfowler/mcp_can @ ^1.5.0
 | 
				
			||||||
 | 
					    mikalhart/TinyGPSPlus @ ^1.0.3
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					[env:pcb_rev_1-2]
 | 
				
			||||||
 | 
					;build_type = debug
 | 
				
			||||||
 | 
					custom_pcb_revision = 2
 | 
				
			||||||
 | 
					build_flags =
 | 
				
			||||||
 | 
					  ${env.build_flags}
 | 
				
			||||||
 | 
					  ;-DFEATURE_ENABLE_WIFI_CLIENT
 | 
				
			||||||
 | 
					  ;-DFEATURE_ENABLE_TIMER
 | 
				
			||||||
 | 
					  -DFEATURE_ENABLE_OLED
 | 
				
			||||||
 | 
					  -DFEATURE_ENABLE_WEBSOCKETS
 | 
				
			||||||
 | 
					  -DPCB_REV=${this.custom_pcb_revision}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					board_build.ldscript = eagle.flash.4m1m.ld
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					lib_deps = 
 | 
				
			||||||
 | 
					    ${env.lib_deps}
 | 
				
			||||||
							
								
								
									
										3
									
								
								Software/prepare_fwfiles.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Software/prepare_fwfiles.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					Import("env")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					env.Replace(PROGNAME="firmware_pcb_1.%s.fw" % env.GetProjectOption("custom_pcb_revision"))
 | 
				
			||||||
@@ -2,12 +2,15 @@
 | 
				
			|||||||
#include "can.h"
 | 
					#include "can.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MCP_CAN CAN0(GPIO_CS_CAN);
 | 
					MCP_CAN CAN0(GPIO_CS_CAN);
 | 
				
			||||||
 | 
					#ifdef CAN_DEBUG_MESSAGE
 | 
				
			||||||
 | 
					void sendCANDebugMessage();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Init_CAN()
 | 
					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...
 | 
				
			||||||
@@ -16,6 +19,17 @@ void Init_CAN()
 | 
				
			|||||||
    CAN0.setMode(MCP_NORMAL);
 | 
					    CAN0.setMode(MCP_NORMAL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void CAN_Process()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    static uint32_t previousMillis = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (millis() - previousMillis >= 100)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        sendCANDebugMessage();
 | 
				
			||||||
 | 
					        previousMillis = millis();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint32_t Process_CAN_WheelSpeed()
 | 
					uint32_t Process_CAN_WheelSpeed()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#define FACTOR_RWP_KMH_890ADV 18 // Divider to convert Raw Data to km/h
 | 
					#define FACTOR_RWP_KMH_890ADV 18 // Divider to convert Raw Data to km/h
 | 
				
			||||||
@@ -41,9 +55,60 @@ 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;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef CAN_DEBUG_MESSAGE
 | 
				
			||||||
 | 
					void sendCANDebugMessage()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#define MAX_DEBUG_MULTIPLEXER 6
 | 
				
			||||||
 | 
					    static uint8_t debugMultiplexer = 0;
 | 
				
			||||||
 | 
					    byte data[8] = {debugMultiplexer, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
 | 
				
			||||||
 | 
					    uint32_t millisValue = millis();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (debugMultiplexer)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					    case 0:
 | 
				
			||||||
 | 
					        memcpy(&data[1], &millisValue, sizeof(millisValue));
 | 
				
			||||||
 | 
					        memcpy(&data[5], &globals.purgePulses, sizeof(globals.purgePulses));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case 1:
 | 
				
			||||||
 | 
					        data[1] = (uint8_t)globals.systemStatus;
 | 
				
			||||||
 | 
					        data[2] = (uint8_t)globals.resumeStatus;
 | 
				
			||||||
 | 
					        data[3] = (uint8_t)globals.requestEEAction;
 | 
				
			||||||
 | 
					        data[4] = globals.TankPercentage;
 | 
				
			||||||
 | 
					        data[5] = (0x01 & globals.hasDTC) | ((0x01 & globals.measurementActive) << 1);
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case 2:
 | 
				
			||||||
 | 
					        memcpy(&data[1], &globals.eePersistanceAdress, sizeof(globals.eePersistanceAdress));
 | 
				
			||||||
 | 
					        memcpy(&data[3], &PersistenceData.tankRemain_microL, sizeof(PersistenceData.tankRemain_microL));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case 3:
 | 
				
			||||||
 | 
					        memcpy(&data[1], &PersistenceData.writeCycleCounter, sizeof(PersistenceData.writeCycleCounter));
 | 
				
			||||||
 | 
					        memcpy(&data[3], &PersistenceData.TravelDistance_highRes_mm, sizeof(PersistenceData.TravelDistance_highRes_mm));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case 4:
 | 
				
			||||||
 | 
					        memcpy(&data[1], &PersistenceData.odometer_mm, sizeof(PersistenceData.odometer_mm));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case 5:
 | 
				
			||||||
 | 
					        memcpy(&data[1], &PersistenceData.odometer, sizeof(PersistenceData.odometer));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case 6:
 | 
				
			||||||
 | 
					        memcpy(&data[1], &PersistenceData.checksum, sizeof(PersistenceData.checksum));
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    debugMultiplexer++;
 | 
				
			||||||
 | 
					    debugMultiplexer = debugMultiplexer > MAX_DEBUG_MULTIPLEXER ? 0 : debugMultiplexer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    byte sndStat = CAN0.sendMsgBuf(0x7FF, 0, 8, data);
 | 
				
			||||||
 | 
					    if (sndStat != CAN_OK)
 | 
				
			||||||
 | 
					        Debug_pushMessage("failed sending CAN-DbgMsg: %d\n", sndStat);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -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;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -258,84 +262,84 @@ uint32_t ConfigSanityCheck(bool autocorrect)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.DistancePerLube_Default > 0) || !(LubeConfig.DistancePerLube_Default < 50000))
 | 
					  if (!(LubeConfig.DistancePerLube_Default > 0) || !(LubeConfig.DistancePerLube_Default < 50000))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 0);
 | 
					    SET_BIT(setting_reset_bits, 0);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.DistancePerLube_Default = LubeConfig_defaults.DistancePerLube_Default;
 | 
					      LubeConfig.DistancePerLube_Default = LubeConfig_defaults.DistancePerLube_Default;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.DistancePerLube_Rain > 0) || !(LubeConfig.DistancePerLube_Rain < 50000))
 | 
					  if (!(LubeConfig.DistancePerLube_Rain > 0) || !(LubeConfig.DistancePerLube_Rain < 50000))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 1);
 | 
					    SET_BIT(setting_reset_bits, 1);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.DistancePerLube_Rain = LubeConfig_defaults.DistancePerLube_Rain;
 | 
					      LubeConfig.DistancePerLube_Rain = LubeConfig_defaults.DistancePerLube_Rain;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.tankCapacity_ml > 0) || !(LubeConfig.tankCapacity_ml < 5000))
 | 
					  if (!(LubeConfig.tankCapacity_ml > 0) || !(LubeConfig.tankCapacity_ml < 5000))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 2);
 | 
					    SET_BIT(setting_reset_bits, 2);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.tankCapacity_ml = LubeConfig_defaults.tankCapacity_ml;
 | 
					      LubeConfig.tankCapacity_ml = LubeConfig_defaults.tankCapacity_ml;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.amountPerDose_microL > 0) || !(LubeConfig.amountPerDose_microL < 100))
 | 
					  if (!(LubeConfig.amountPerDose_microL > 0) || !(LubeConfig.amountPerDose_microL < 100))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 3);
 | 
					    SET_BIT(setting_reset_bits, 3);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.amountPerDose_microL = LubeConfig_defaults.amountPerDose_microL;
 | 
					      LubeConfig.amountPerDose_microL = LubeConfig_defaults.amountPerDose_microL;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.TankRemindAtPercentage >= 0) || !(LubeConfig.TankRemindAtPercentage <= 100))
 | 
					  if (!(LubeConfig.TankRemindAtPercentage >= 0) || !(LubeConfig.TankRemindAtPercentage <= 100))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 4);
 | 
					    SET_BIT(setting_reset_bits, 4);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.TankRemindAtPercentage = LubeConfig_defaults.TankRemindAtPercentage;
 | 
					      LubeConfig.TankRemindAtPercentage = LubeConfig_defaults.TankRemindAtPercentage;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.PulsePerRevolution > 0) || !(LubeConfig.PulsePerRevolution < 1000))
 | 
					  if (!(LubeConfig.PulsePerRevolution > 0) || !(LubeConfig.PulsePerRevolution < 1000))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 5);
 | 
					    SET_BIT(setting_reset_bits, 5);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.PulsePerRevolution = LubeConfig_defaults.PulsePerRevolution;
 | 
					      LubeConfig.PulsePerRevolution = LubeConfig_defaults.PulsePerRevolution;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.TireWidth_mm > 0) || !(LubeConfig.TireWidth_mm < 500))
 | 
					  if (!(LubeConfig.TireWidth_mm > 0) || !(LubeConfig.TireWidth_mm < 500))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 6);
 | 
					    SET_BIT(setting_reset_bits, 6);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.TireWidth_mm = LubeConfig_defaults.TireWidth_mm;
 | 
					      LubeConfig.TireWidth_mm = LubeConfig_defaults.TireWidth_mm;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.TireWidthHeight_Ratio > 0) || !(LubeConfig.TireWidthHeight_Ratio < 150))
 | 
					  if (!(LubeConfig.TireWidthHeight_Ratio > 0) || !(LubeConfig.TireWidthHeight_Ratio < 150))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 7);
 | 
					    SET_BIT(setting_reset_bits, 7);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.TireWidthHeight_Ratio = LubeConfig_defaults.TireWidthHeight_Ratio;
 | 
					      LubeConfig.TireWidthHeight_Ratio = LubeConfig_defaults.TireWidthHeight_Ratio;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.RimDiameter_Inch > 0) || !(LubeConfig.RimDiameter_Inch < 30))
 | 
					  if (!(LubeConfig.RimDiameter_Inch > 0) || !(LubeConfig.RimDiameter_Inch < 30))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 8);
 | 
					    SET_BIT(setting_reset_bits, 8);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.RimDiameter_Inch = LubeConfig_defaults.RimDiameter_Inch;
 | 
					      LubeConfig.RimDiameter_Inch = LubeConfig_defaults.RimDiameter_Inch;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.DistancePerRevolution_mm > 0) || !(LubeConfig.DistancePerRevolution_mm < 10000))
 | 
					  if (!(LubeConfig.DistancePerRevolution_mm > 0) || !(LubeConfig.DistancePerRevolution_mm < 10000))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 9);
 | 
					    SET_BIT(setting_reset_bits, 9);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.DistancePerRevolution_mm = LubeConfig_defaults.DistancePerRevolution_mm;
 | 
					      LubeConfig.DistancePerRevolution_mm = LubeConfig_defaults.DistancePerRevolution_mm;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.BleedingPulses > 0) || !(LubeConfig.BleedingPulses < 1001))
 | 
					  if (!(LubeConfig.BleedingPulses > 0) || !(LubeConfig.BleedingPulses < 1001))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 10);
 | 
					    SET_BIT(setting_reset_bits, 10);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.BleedingPulses = LubeConfig_defaults.BleedingPulses;
 | 
					      LubeConfig.BleedingPulses = LubeConfig_defaults.BleedingPulses;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!(LubeConfig.SpeedSource >= 0) || !(LubeConfig.SpeedSource < SpeedSourceString_Elements))
 | 
					  if (!(LubeConfig.SpeedSource >= 0) || !(LubeConfig.SpeedSource < SpeedSourceString_Elements))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 11);
 | 
					    SET_BIT(setting_reset_bits, 11);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.SpeedSource = LubeConfig_defaults.SpeedSource;
 | 
					      LubeConfig.SpeedSource = LubeConfig_defaults.SpeedSource;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -343,7 +347,7 @@ uint32_t ConfigSanityCheck(bool autocorrect)
 | 
				
			|||||||
#ifdef FEATURE_ENABLE_GPS
 | 
					#ifdef FEATURE_ENABLE_GPS
 | 
				
			||||||
  if (!(LubeConfig.GPSBaudRate >= 0) || !(LubeConfig.GPSBaudRate < GPSBaudRateString_Elements))
 | 
					  if (!(LubeConfig.GPSBaudRate >= 0) || !(LubeConfig.GPSBaudRate < GPSBaudRateString_Elements))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 12);
 | 
					    SET_BIT(setting_reset_bits, 12);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.GPSBaudRate = LubeConfig_defaults.GPSBaudRate;
 | 
					      LubeConfig.GPSBaudRate = LubeConfig_defaults.GPSBaudRate;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -352,7 +356,7 @@ uint32_t ConfigSanityCheck(bool autocorrect)
 | 
				
			|||||||
#ifdef FEATURE_ENABLE_CAN
 | 
					#ifdef FEATURE_ENABLE_CAN
 | 
				
			||||||
  if (!(LubeConfig.CANSource >= 0) || !(LubeConfig.CANSource < CANSourceString_Elements))
 | 
					  if (!(LubeConfig.CANSource >= 0) || !(LubeConfig.CANSource < CANSourceString_Elements))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    setting_reset_bits = setting_reset_bits | (1 << 13);
 | 
					    SET_BIT(setting_reset_bits, 13);
 | 
				
			||||||
    if (autocorrect)
 | 
					    if (autocorrect)
 | 
				
			||||||
      LubeConfig.CANSource = LubeConfig_defaults.CANSource;
 | 
					      LubeConfig.CANSource = LubeConfig_defaults.CANSource;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ void Debug_Process()
 | 
				
			|||||||
        CMD_OVERFLOW
 | 
					        CMD_OVERFLOW
 | 
				
			||||||
    } InputProcessed_t;
 | 
					    } InputProcessed_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static int inputCnt = 0;
 | 
					    static unsigned int inputCnt = 0;
 | 
				
			||||||
    static char inputBuffer[32];
 | 
					    static char inputBuffer[32];
 | 
				
			||||||
    InputProcessed_t InputProcessed = IDLE;
 | 
					    InputProcessed_t InputProcessed = IDLE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -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);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -334,7 +334,7 @@ void Debug_printHelp()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    char buff[64];
 | 
					    char buff[64];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (int i = sizeof(helpCmd) / 63; i < sizeof(helpCmd) / 63; i++)
 | 
					    for (unsigned int i = sizeof(helpCmd) / 63; i < sizeof(helpCmd) / 63; i++)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        memcpy_P(buff, (helpCmd + (i * 63)), 63);
 | 
					        memcpy_P(buff, (helpCmd + (i * 63)), 63);
 | 
				
			||||||
        buff[63] = 0;
 | 
					        buff[63] = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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;
 | 
				
			||||||
@@ -22,6 +22,7 @@ void RunLubeApp(uint32_t add_milimeters)
 | 
				
			|||||||
    switch (globals.systemStatus)
 | 
					    switch (globals.systemStatus)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    case sysStat_Startup:
 | 
					    case sysStat_Startup:
 | 
				
			||||||
 | 
					        strcpy_P(globals.systemStatustxt, PSTR("Startup"));
 | 
				
			||||||
        if (millis() > STARTUP_DELAY)
 | 
					        if (millis() > STARTUP_DELAY)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            globals.systemStatus = sysStat_Normal;
 | 
					            globals.systemStatus = sysStat_Normal;
 | 
				
			||||||
@@ -30,6 +31,7 @@ void RunLubeApp(uint32_t add_milimeters)
 | 
				
			|||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case sysStat_Normal:
 | 
					    case sysStat_Normal:
 | 
				
			||||||
 | 
					        strcpy_P(globals.systemStatustxt, PSTR("Normal"));
 | 
				
			||||||
        if (PersistenceData.TravelDistance_highRes_mm / 1000 > LubeConfig.DistancePerLube_Default)
 | 
					        if (PersistenceData.TravelDistance_highRes_mm / 1000 > LubeConfig.DistancePerLube_Default)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            LubePulse();
 | 
					            LubePulse();
 | 
				
			||||||
@@ -38,6 +40,7 @@ void RunLubeApp(uint32_t add_milimeters)
 | 
				
			|||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case sysStat_Rain:
 | 
					    case sysStat_Rain:
 | 
				
			||||||
 | 
					        strcpy_P(globals.systemStatustxt, PSTR("Rain"));
 | 
				
			||||||
        if (PersistenceData.TravelDistance_highRes_mm / 1000 > LubeConfig.DistancePerLube_Rain)
 | 
					        if (PersistenceData.TravelDistance_highRes_mm / 1000 > LubeConfig.DistancePerLube_Rain)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            LubePulse();
 | 
					            LubePulse();
 | 
				
			||||||
@@ -45,12 +48,14 @@ void RunLubeApp(uint32_t add_milimeters)
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case sysStat_Purge:
 | 
					    case sysStat_Purge:
 | 
				
			||||||
 | 
					        strcpy_P(globals.systemStatustxt, PSTR("Purge"));
 | 
				
			||||||
        if (globals.purgePulses > 0)
 | 
					        if (globals.purgePulses > 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (lubePulseTimestamp + LUBE_PULSE_PAUSE_MS < millis())
 | 
					            if (lubePulseTimestamp + LUBE_PULSE_PAUSE_MS < millis())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                LubePulse();
 | 
					                LubePulse();
 | 
				
			||||||
                globals.purgePulses--;
 | 
					                globals.purgePulses--;
 | 
				
			||||||
 | 
					                Debug_pushMessage("Purge remain: %d\n", globals.purgePulses);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
@@ -58,32 +63,14 @@ void RunLubeApp(uint32_t add_milimeters)
 | 
				
			|||||||
            globals.systemStatus = globals.resumeStatus;
 | 
					            globals.systemStatus = globals.resumeStatus;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case sysStat_Error:
 | 
					 | 
				
			||||||
    case sysStat_Shutdown:
 | 
					 | 
				
			||||||
    default:
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (globals.systemStatus)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    case sysStat_Normal:
 | 
					 | 
				
			||||||
        strcpy_P(globals.systemStatustxt, PSTR("Normal"));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case sysStat_Purge:
 | 
					 | 
				
			||||||
        strcpy_P(globals.systemStatustxt, PSTR("Purge"));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case sysStat_Rain:
 | 
					 | 
				
			||||||
        strcpy_P(globals.systemStatustxt, PSTR("Rain"));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case sysStat_Startup:
 | 
					 | 
				
			||||||
        strcpy_P(globals.systemStatustxt, PSTR("Startup"));
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    case sysStat_Error:
 | 
					    case sysStat_Error:
 | 
				
			||||||
        strcpy_P(globals.systemStatustxt, PSTR("Error"));
 | 
					        strcpy_P(globals.systemStatustxt, PSTR("Error"));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case sysStat_Shutdown:
 | 
					    case sysStat_Shutdown:
 | 
				
			||||||
        strcpy_P(globals.systemStatustxt, PSTR("Shutdown"));
 | 
					        strcpy_P(globals.systemStatustxt, PSTR("Shutdown"));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // maintain Pin-State of Lube-Pump
 | 
					    // maintain Pin-State of Lube-Pump
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,44 +79,40 @@ void setup()
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Serial.begin(115200);
 | 
					  Serial.begin(115200);
 | 
				
			||||||
  Serial.println("\n\nSouko's ChainLube Mk1");
 | 
					  Serial.print("\n\nSouko's ChainLube Mk1\n");
 | 
				
			||||||
  Serial.println(globals.DeviceName);
 | 
					  Serial.print(globals.DeviceName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  InitEEPROM();
 | 
					  InitEEPROM();
 | 
				
			||||||
  GetConfig_EEPROM();
 | 
					  GetConfig_EEPROM();
 | 
				
			||||||
  GetPersistence_EEPROM();
 | 
					  GetPersistence_EEPROM();
 | 
				
			||||||
 | 
					  Serial.print("\nEE-Init done");
 | 
				
			||||||
#ifdef FEATURE_ENABLE_OLED
 | 
					#ifdef FEATURE_ENABLE_OLED
 | 
				
			||||||
  u8x8.begin();
 | 
					  u8x8.begin();
 | 
				
			||||||
  u8x8.setFont(u8x8_font_chroma48medium8_r);
 | 
					  u8x8.setFont(u8x8_font_chroma48medium8_r);
 | 
				
			||||||
 | 
					  u8x8.clearDisplay();
 | 
				
			||||||
 | 
					  u8x8.drawString(0, 0, "KTM ChainLube V1");
 | 
				
			||||||
 | 
					  u8x8.refreshDisplay();
 | 
				
			||||||
 | 
					  Serial.print("\nDisplay-Init done");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  leds.begin();
 | 
					  leds.begin();
 | 
				
			||||||
 | 
					  Serial.print("\nLED-Init done");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  switch (LubeConfig.SpeedSource)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
  case SOURCE_IMPULSE:
 | 
					 | 
				
			||||||
  pinMode(GPIO_TRIGGER, INPUT_PULLUP);
 | 
					  pinMode(GPIO_TRIGGER, INPUT_PULLUP);
 | 
				
			||||||
  attachInterrupt(digitalPinToInterrupt(GPIO_TRIGGER), trigger_ISR, FALLING);
 | 
					  attachInterrupt(digitalPinToInterrupt(GPIO_TRIGGER), trigger_ISR, FALLING);
 | 
				
			||||||
    break;
 | 
					  Serial.print("\nPulse-Input Init done");
 | 
				
			||||||
#ifdef FEATURE_ENABLE_GPS
 | 
					#ifdef FEATURE_ENABLE_GPS
 | 
				
			||||||
  case SOURCE_GPS:
 | 
					 | 
				
			||||||
  Init_GPS();
 | 
					  Init_GPS();
 | 
				
			||||||
    break;
 | 
					  Serial.print("\nGPS-Init done");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#ifdef FEATURE_ENABLE_TIMER
 | 
					 | 
				
			||||||
  case SOURCE_TIME:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    break;
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef FEATURE_ENABLE_CAN
 | 
					#ifdef FEATURE_ENABLE_CAN
 | 
				
			||||||
  case SOURCE_CAN:
 | 
					  if (LubeConfig.SpeedSource != SOURCE_IMPULSE)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    Init_CAN();
 | 
					    Init_CAN();
 | 
				
			||||||
    break;
 | 
					    Serial.print("\nCAN-Init done");
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
  default:
 | 
					 | 
				
			||||||
    Debug_pushMessage("Source Setting N/A");
 | 
					 | 
				
			||||||
    break;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Serial.print("\nSource-Init done");
 | 
				
			||||||
  pinMode(GPIO_BUTTON, INPUT_PULLUP);
 | 
					  pinMode(GPIO_BUTTON, INPUT_PULLUP);
 | 
				
			||||||
  pinMode(GPIO_PUMP, OUTPUT);
 | 
					  pinMode(GPIO_PUMP, OUTPUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -151,17 +147,13 @@ void setup()
 | 
				
			|||||||
                     u8x8.refreshDisplay(); });
 | 
					                     u8x8.refreshDisplay(); });
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  ArduinoOTA.begin();
 | 
					  ArduinoOTA.begin();
 | 
				
			||||||
 | 
					  Serial.print("\nOTA-Init done");
 | 
				
			||||||
#ifdef FEATURE_ENABLE_OLED
 | 
					 | 
				
			||||||
  u8x8.clearDisplay();
 | 
					 | 
				
			||||||
  u8x8.drawString(0, 0, "KTM ChainLube V1");
 | 
					 | 
				
			||||||
  u8x8.refreshDisplay();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  initWebUI();
 | 
					  initWebUI();
 | 
				
			||||||
 | 
					  Serial.print("\nWebUI-Init done");
 | 
				
			||||||
  initGlobals();
 | 
					  initGlobals();
 | 
				
			||||||
 | 
					  Serial.print("\nglobals-Init done");
 | 
				
			||||||
  EEPROMCyclicPDSTicker.start();
 | 
					  EEPROMCyclicPDSTicker.start();
 | 
				
			||||||
  Serial.println("Setup Done");
 | 
					  Serial.print("\nSetup Done\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void loop()
 | 
					void loop()
 | 
				
			||||||
@@ -192,6 +184,12 @@ void loop()
 | 
				
			|||||||
  RunLubeApp(wheelDistance);
 | 
					  RunLubeApp(wheelDistance);
 | 
				
			||||||
#ifdef FEATURE_ENABLE_OLED
 | 
					#ifdef FEATURE_ENABLE_OLED
 | 
				
			||||||
  Display_Process();
 | 
					  Display_Process();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef FEATURE_ENABLE_CAN
 | 
				
			||||||
 | 
					  if (LubeConfig.SpeedSource != SOURCE_IMPULSE)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    CAN_Process();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  Button_Process();
 | 
					  Button_Process();
 | 
				
			||||||
  LED_Process();
 | 
					  LED_Process();
 | 
				
			||||||
@@ -284,7 +282,7 @@ void LED_Process(uint8_t override, uint32_t SetColor)
 | 
				
			|||||||
    if (LED_Status != LED_Override)
 | 
					    if (LED_Status != LED_Override)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      LED_ResumeOverrideStatus = LED_Status;
 | 
					      LED_ResumeOverrideStatus = LED_Status;
 | 
				
			||||||
      Debug_pushMessage("Override LED_Status");
 | 
					      Debug_pushMessage("Override LED_Status\n");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    LED_Status = LED_Override;
 | 
					    LED_Status = LED_Override;
 | 
				
			||||||
    LED_override_color = SetColor;
 | 
					    LED_override_color = SetColor;
 | 
				
			||||||
@@ -295,7 +293,7 @@ void LED_Process(uint8_t override, uint32_t SetColor)
 | 
				
			|||||||
    if (LED_Status == LED_Override)
 | 
					    if (LED_Status == LED_Override)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      LED_Status = LED_ResumeOverrideStatus;
 | 
					      LED_Status = LED_ResumeOverrideStatus;
 | 
				
			||||||
      Debug_pushMessage("Resume LED_Status");
 | 
					      Debug_pushMessage("Resume LED_Status\n");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -305,29 +303,29 @@ void LED_Process(uint8_t override, uint32_t SetColor)
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
    case sysStat_Startup:
 | 
					    case sysStat_Startup:
 | 
				
			||||||
      LED_Status = LED_Startup;
 | 
					      LED_Status = LED_Startup;
 | 
				
			||||||
      Debug_pushMessage("sysStat: Startup");
 | 
					      Debug_pushMessage("sysStat: Startup\n");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case sysStat_Normal:
 | 
					    case sysStat_Normal:
 | 
				
			||||||
      timestamp = timer + 3500;
 | 
					      timestamp = timer + 3500;
 | 
				
			||||||
      LED_Status = LED_Confirm_Normal;
 | 
					      LED_Status = LED_Confirm_Normal;
 | 
				
			||||||
      Debug_pushMessage("sysStat: Normal");
 | 
					      Debug_pushMessage("sysStat: Normal\n");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case sysStat_Rain:
 | 
					    case sysStat_Rain:
 | 
				
			||||||
      timestamp = timer + 3500;
 | 
					      timestamp = timer + 3500;
 | 
				
			||||||
      LED_Status = LED_Confirm_Rain;
 | 
					      LED_Status = LED_Confirm_Rain;
 | 
				
			||||||
      Debug_pushMessage("sysStat: Rain");
 | 
					      Debug_pushMessage("sysStat: Rain\n");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case sysStat_Purge:
 | 
					    case sysStat_Purge:
 | 
				
			||||||
      LED_Status = LED_Purge;
 | 
					      LED_Status = LED_Purge;
 | 
				
			||||||
      Debug_pushMessage("sysStat: Purge");
 | 
					      Debug_pushMessage("sysStat: Purge\n");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case sysStat_Error:
 | 
					    case sysStat_Error:
 | 
				
			||||||
      LED_Status = LED_Error;
 | 
					      LED_Status = LED_Error;
 | 
				
			||||||
      Debug_pushMessage("sysStat: Error");
 | 
					      Debug_pushMessage("sysStat: Error\n");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case sysStat_Shutdown:
 | 
					    case sysStat_Shutdown:
 | 
				
			||||||
      LED_Status = LED_Shutdown;
 | 
					      LED_Status = LED_Shutdown;
 | 
				
			||||||
      Debug_pushMessage("sysStat: Shutdown");
 | 
					      Debug_pushMessage("sysStat: Shutdown\n");
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
@@ -358,7 +356,7 @@ void LED_Process(uint8_t override, uint32_t SetColor)
 | 
				
			|||||||
    if (timestamp < timer)
 | 
					    if (timestamp < timer)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      LED_Status = LED_Normal;
 | 
					      LED_Status = LED_Normal;
 | 
				
			||||||
      Debug_pushMessage("LED_Status: Confirm -> Normal");
 | 
					      Debug_pushMessage("LED_Status: Confirm -> Normal\n");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -384,7 +382,7 @@ void LED_Process(uint8_t override, uint32_t SetColor)
 | 
				
			|||||||
    if (timestamp < timer)
 | 
					    if (timestamp < timer)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      LED_Status = LED_Rain;
 | 
					      LED_Status = LED_Rain;
 | 
				
			||||||
      Debug_pushMessage("LED_Status: Confirm -> Rain");
 | 
					      Debug_pushMessage("LED_Status: Confirm -> Rain\n");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -528,13 +526,13 @@ void Button_Process()
 | 
				
			|||||||
      {
 | 
					      {
 | 
				
			||||||
      case BTN_TOGGLEWIFI:
 | 
					      case BTN_TOGGLEWIFI:
 | 
				
			||||||
        toggleWiFiAP();
 | 
					        toggleWiFiAP();
 | 
				
			||||||
        Debug_pushMessage("Starting WiFi AP");
 | 
					        Debug_pushMessage("Starting WiFi AP\n");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      case BTN_STARTPURGE:
 | 
					      case BTN_STARTPURGE:
 | 
				
			||||||
        globals.systemStatus = sysStat_Purge;
 | 
					        globals.systemStatus = sysStat_Purge;
 | 
				
			||||||
        globals.purgePulses = LubeConfig.BleedingPulses;
 | 
					        globals.purgePulses = LubeConfig.BleedingPulses;
 | 
				
			||||||
        Debug_pushMessage("Starting Purge");
 | 
					        Debug_pushMessage("Starting Purge\n");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      case BTN_TOGGLEMODE:
 | 
					      case BTN_TOGGLEMODE:
 | 
				
			||||||
@@ -552,12 +550,12 @@ void Button_Process()
 | 
				
			|||||||
        default:
 | 
					        default:
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Debug_pushMessage("Toggling Mode");
 | 
					        Debug_pushMessage("Toggling Mode\n");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      case BTN_NOTHING:
 | 
					      case BTN_NOTHING:
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        Debug_pushMessage("Nothing or invalid");
 | 
					        Debug_pushMessage("Nothing or invalid\n");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      LED_Process(2);
 | 
					      LED_Process(2);
 | 
				
			||||||
@@ -572,7 +570,7 @@ void toggleWiFiAP(boolean shutdown)
 | 
				
			|||||||
  if (WiFi.getMode() != WIFI_OFF)
 | 
					  if (WiFi.getMode() != WIFI_OFF)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    WiFi.mode(WIFI_OFF);
 | 
					    WiFi.mode(WIFI_OFF);
 | 
				
			||||||
    Debug_pushMessage("WiFi turned off");
 | 
					    Debug_pushMessage("WiFi turned off\n");
 | 
				
			||||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
 | 
					#ifdef FEATURE_ENABLE_WIFI_CLIENT
 | 
				
			||||||
    WiFiMaintainConnectionTicker.stop();
 | 
					    WiFiMaintainConnectionTicker.stop();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -584,9 +582,9 @@ void toggleWiFiAP(boolean shutdown)
 | 
				
			|||||||
    WiFi.softAP(globals.DeviceName, QUOTE(WIFI_AP_PASSWORD));
 | 
					    WiFi.softAP(globals.DeviceName, QUOTE(WIFI_AP_PASSWORD));
 | 
				
			||||||
#ifdef FEATURE_ENABLE_WIFI_CLIENT
 | 
					#ifdef FEATURE_ENABLE_WIFI_CLIENT
 | 
				
			||||||
    WiFiMaintainConnectionTicker.stop();
 | 
					    WiFiMaintainConnectionTicker.stop();
 | 
				
			||||||
    Debug_pushMessage("WiFi AP started, stopped Maintain-Timer");
 | 
					    Debug_pushMessage("WiFi AP started, stopped Maintain-Timer\n");
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    Debug_pushMessage("WiFi AP started");
 | 
					    Debug_pushMessage("WiFi AP started\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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>";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -233,7 +237,7 @@ String processor(const String &var)
 | 
				
			|||||||
    return temp;
 | 
					    return temp;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef FEATURE_EABLE_GPS
 | 
					#ifdef FEATURE_ENABLE_GPS
 | 
				
			||||||
  if (var == "GPSBAUD_SELECT_OPTIONS")
 | 
					  if (var == "GPSBAUD_SELECT_OPTIONS")
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    String temp;
 | 
					    String temp;
 | 
				
			||||||
@@ -315,7 +319,7 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
 | 
				
			|||||||
    if (p->name() == "pulsesave")
 | 
					    if (p->name() == "pulsesave")
 | 
				
			||||||
      globals.requestEEAction = EE_CFG_SAVE;
 | 
					      globals.requestEEAction = EE_CFG_SAVE;
 | 
				
			||||||
      // end: POST Form Source Pulse Settings
 | 
					      // end: POST Form Source Pulse Settings
 | 
				
			||||||
#ifdef FEATURE_EABLE_GPS
 | 
					#ifdef FEATURE_ENABLE_GPS
 | 
				
			||||||
    // begin: POST Form Source GPS Settings
 | 
					    // begin: POST Form Source GPS Settings
 | 
				
			||||||
    if (p->name() == "gpsbaud")
 | 
					    if (p->name() == "gpsbaud")
 | 
				
			||||||
      LubeConfig.GPSBaudRate = (GPSBaudRate_t)p->value().toInt();
 | 
					      LubeConfig.GPSBaudRate = (GPSBaudRate_t)p->value().toInt();
 | 
				
			||||||
@@ -323,7 +327,7 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
 | 
				
			|||||||
      globals.requestEEAction = EE_CFG_SAVE;
 | 
					      globals.requestEEAction = EE_CFG_SAVE;
 | 
				
			||||||
// end: POST Form Source GPS Settings
 | 
					// end: POST Form Source GPS Settings
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef FEATURE_EABLE_CAN
 | 
					#ifdef FEATURE_ENABLE_CAN
 | 
				
			||||||
    // begin: POST Form Source CAN Settings
 | 
					    // begin: POST Form Source CAN Settings
 | 
				
			||||||
    if (p->name() == "cansource")
 | 
					    if (p->name() == "cansource")
 | 
				
			||||||
      LubeConfig.CANSource = (CANSource_t)p->value().toInt();
 | 
					      LubeConfig.CANSource = (CANSource_t)p->value().toInt();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user