2022-04-14 22:48:11 +02:00
|
|
|
#ifndef _DTC_H_
|
|
|
|
#define _DTC_H_
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
#define MAX_DTC_STORAGE 6
|
|
|
|
|
|
|
|
typedef enum DTCNums_e
|
|
|
|
{
|
|
|
|
DTC_NO_EEPROM_FOUND,
|
|
|
|
DTC_EEPROM_CFG_BAD,
|
|
|
|
DTC_EEPROM_PDS_BAD,
|
2023-02-20 13:51:54 +01:00
|
|
|
DTC_EEPROM_PDSADRESS_BAD,
|
2022-05-15 16:37:34 +02:00
|
|
|
DTC_EEPROM_VERSION_BAD,
|
2023-02-20 13:51:54 +01:00
|
|
|
DTC_FLASHFS_ERROR,
|
|
|
|
DTC_FLASHFS_VERSION_ERROR,
|
|
|
|
DTC_EEPROM_CFG_SANITY,
|
2023-04-12 22:47:17 +02:00
|
|
|
DTC_NO_LORA_FOUND,
|
|
|
|
DTC_NO_BATMNON_FOUND,
|
2022-04-14 22:48:11 +02:00
|
|
|
DTC_LAST_DTC
|
|
|
|
} DTCNums_t;
|
|
|
|
|
|
|
|
typedef enum DTCActive_e
|
|
|
|
{
|
|
|
|
DTC_ACTIVE,
|
|
|
|
DTC_PREVIOUS,
|
|
|
|
DTC_NONE
|
|
|
|
} DTCActive_t;
|
|
|
|
|
2023-02-20 13:51:54 +01:00
|
|
|
typedef enum DTCSeverity_e
|
|
|
|
{
|
|
|
|
DTC_INFO,
|
|
|
|
DTC_WARN,
|
|
|
|
DTC_CRITICAL
|
|
|
|
} DTCSeverity_t;
|
|
|
|
|
2022-04-14 22:48:11 +02:00
|
|
|
typedef struct DTCEntry_s
|
|
|
|
{
|
|
|
|
DTCNums_t Number;
|
|
|
|
uint32_t timestamp;
|
|
|
|
DTCActive_t active;
|
2023-02-20 13:51:54 +01:00
|
|
|
DTCSeverity_t severity;
|
|
|
|
uint32_t debugVal;
|
2022-04-14 22:48:11 +02:00
|
|
|
} DTCEntry_t;
|
|
|
|
|
2023-02-20 13:51:54 +01:00
|
|
|
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue = 0);
|
2022-04-14 22:48:11 +02:00
|
|
|
void ClearDTC(DTCNums_t DTC_no);
|
|
|
|
void ClearAllDTC();
|
|
|
|
DTCNums_t getlastDTC(boolean only_active);
|
2023-02-20 13:51:54 +01:00
|
|
|
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
|
2022-04-14 22:48:11 +02:00
|
|
|
|
|
|
|
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
|
|
|
#endif
|