59 lines
1.1 KiB
C
Raw Normal View History

#ifndef _DTC_H_
#define _DTC_H_
#include <Arduino.h>
2022-03-09 23:05:17 +01:00
#define MAX_DTC_STORAGE 6
typedef enum DTCNums_e
{
DTC_TANK_EMPTY = 1,
DTC_TANK_LOW,
2022-03-09 23:05:17 +01:00
DTC_NO_EEPROM_FOUND,
DTC_EEPROM_CFG_BAD,
DTC_EEPROM_PDS_BAD,
DTC_EEPROM_PDSADRESS_BAD,
DTC_EEPROM_VERSION_BAD,
2022-08-14 17:38:45 +02:00
DTC_FLASHFS_ERROR,
DTC_FLASHFS_VERSION_ERROR,
#ifdef FEATURE_ENABLE_GPS
DTC_NO_GPS_SERIAL,
#endif
#ifdef FEATURE_ENABLE_CAN
2022-03-10 19:44:43 +01:00
DTC_CAN_TRANSCEIVER_FAILED,
DTC_NO_CAN_SIGNAL,
#endif
2022-09-01 21:29:07 +02:00
DTC_EEPROM_CFG_SANITY,
DTC_LAST_DTC
} DTCNums_t;
typedef enum DTCActive_e
{
2022-05-01 15:15:32 +02:00
DTC_NONE,
DTC_ACTIVE,
2022-05-01 15:15:32 +02:00
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;
DTCActive_t active;
DTCSeverity_t severity;
} DTCEntry_t;
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active);
void ClearDTC(DTCNums_t DTC_no);
void ClearAllDTC();
DTCNums_t getlastDTC(boolean only_active);
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
#endif