reworked DTC-Data handling
This commit is contained in:
@@ -2,56 +2,25 @@
|
||||
#define _DTC_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "dtc_defs.h"
|
||||
|
||||
#define MAX_DTC_STORAGE 6
|
||||
|
||||
typedef enum DTCNums_e
|
||||
typedef struct
|
||||
{
|
||||
DTC_TANK_EMPTY = 1,
|
||||
DTC_TANK_LOW,
|
||||
DTC_NO_EEPROM_FOUND,
|
||||
DTC_EEPROM_CFG_BAD,
|
||||
DTC_EEPROM_PDS_BAD,
|
||||
DTC_EEPROM_PDSADRESS_BAD,
|
||||
DTC_EEPROM_VERSION_BAD,
|
||||
DTC_FLASHFS_ERROR,
|
||||
DTC_FLASHFS_VERSION_ERROR,
|
||||
DTC_NO_GPS_SERIAL,
|
||||
DTC_CAN_TRANSCEIVER_FAILED,
|
||||
DTC_NO_CAN_SIGNAL,
|
||||
DTC_EEPROM_CFG_SANITY,
|
||||
DTC_LAST_DTC
|
||||
} DTCNums_t;
|
||||
|
||||
typedef enum DTCActive_e
|
||||
{
|
||||
DTC_NONE,
|
||||
DTC_ACTIVE,
|
||||
DTC_PREVIOUS
|
||||
} DTCActive_t;
|
||||
|
||||
typedef enum DTCSeverity_e
|
||||
{
|
||||
DTC_INFO,
|
||||
DTC_WARN,
|
||||
DTC_CRITICAL
|
||||
} DTCSeverity_t;
|
||||
|
||||
typedef struct DTCEntry_s
|
||||
{
|
||||
DTCNums_t Number;
|
||||
DTCNum_t Number;
|
||||
uint32_t timestamp;
|
||||
DTCActive_t active;
|
||||
DTCSeverity_t severity;
|
||||
uint32_t debugVal;
|
||||
} DTCEntry_t;
|
||||
|
||||
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue = 0);
|
||||
void ClearDTC(DTCNums_t DTC_no);
|
||||
void MaintainDTC(DTCNum_t DTC_no, boolean active, uint32_t DebugValue = 0);
|
||||
void ClearDTC(DTCNum_t DTC_no);
|
||||
void ClearAllDTC();
|
||||
DTCNums_t getlastDTC(boolean only_active);
|
||||
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
|
||||
DTCNum_t getlastDTC(boolean only_active);
|
||||
DTCNum_t ActiveDTCseverity(DTCSeverity_t severity);
|
||||
DTCSeverity_t getSeverityForDTC(DTCNum_t targetCode);
|
||||
void DTC_Process();
|
||||
|
||||
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
||||
extern DTCEntry_t DTCStorage[MAX_DTC_STORAGE];
|
||||
#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
|
Reference in New Issue
Block a user