2022-02-10 22:32:40 +01:00
|
|
|
#ifndef _DTC_H_
|
|
|
|
#define _DTC_H_
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
2022-03-09 23:05:17 +01:00
|
|
|
#define MAX_DTC_STORAGE 6
|
2022-02-10 22:32:40 +01:00
|
|
|
|
2022-03-09 20:25:02 +01:00
|
|
|
typedef enum DTCNums_e
|
|
|
|
{
|
2022-05-04 23:06:15 +02:00
|
|
|
DTC_TANK_EMPTY = 1,
|
2022-08-22 14:13:55 +02:00
|
|
|
DTC_TANK_LOW,
|
2022-03-09 23:05:17 +01:00
|
|
|
DTC_NO_EEPROM_FOUND,
|
|
|
|
DTC_EEPROM_CFG_BAD,
|
|
|
|
DTC_EEPROM_PDS_BAD,
|
2022-08-19 11:25:26 +02:00
|
|
|
DTC_EEPROM_PDSADRESS_BAD,
|
2022-05-02 20:29:17 +02:00
|
|
|
DTC_EEPROM_VERSION_BAD,
|
2022-08-14 17:38:45 +02:00
|
|
|
DTC_FLASHFS_ERROR,
|
2022-08-22 14:26:37 +02:00
|
|
|
DTC_FLASHFS_VERSION_ERROR,
|
2022-05-04 23:06:15 +02:00
|
|
|
#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,
|
2022-05-04 23:06:15 +02:00
|
|
|
#endif
|
2022-09-01 21:29:07 +02:00
|
|
|
DTC_EEPROM_CFG_SANITY,
|
2022-03-09 20:25:02 +01:00
|
|
|
DTC_LAST_DTC
|
|
|
|
} DTCNums_t;
|
2022-02-10 22:32:40 +01:00
|
|
|
|
|
|
|
typedef enum DTCActive_e
|
|
|
|
{
|
2022-05-01 15:15:32 +02:00
|
|
|
DTC_NONE,
|
2022-03-09 20:25:02 +01:00
|
|
|
DTC_ACTIVE,
|
2022-05-01 15:15:32 +02:00
|
|
|
DTC_PREVIOUS
|
2022-03-09 20:25:02 +01:00
|
|
|
} DTCActive_t;
|
2022-02-10 22:32:40 +01:00
|
|
|
|
2022-08-22 14:13:55 +02:00
|
|
|
typedef enum DTCSeverity_e
|
|
|
|
{
|
|
|
|
DTC_INFO,
|
|
|
|
DTC_WARN,
|
|
|
|
DTC_CRITICAL
|
|
|
|
} DTCSeverity_t;
|
|
|
|
|
2022-02-10 22:32:40 +01:00
|
|
|
typedef struct DTCEntry_s
|
|
|
|
{
|
2022-03-09 20:25:02 +01:00
|
|
|
DTCNums_t Number;
|
2022-02-10 22:32:40 +01:00
|
|
|
uint32_t timestamp;
|
2022-03-09 20:25:02 +01:00
|
|
|
DTCActive_t active;
|
2022-08-22 14:13:55 +02:00
|
|
|
DTCSeverity_t severity;
|
2022-02-10 22:32:40 +01:00
|
|
|
} DTCEntry_t;
|
|
|
|
|
2022-08-22 14:13:55 +02:00
|
|
|
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active);
|
2022-03-09 20:25:02 +01:00
|
|
|
void ClearDTC(DTCNums_t DTC_no);
|
2022-02-10 22:32:40 +01:00
|
|
|
void ClearAllDTC();
|
2022-03-09 20:25:02 +01:00
|
|
|
DTCNums_t getlastDTC(boolean only_active);
|
2022-08-22 14:13:55 +02:00
|
|
|
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
|
2022-02-10 22:32:40 +01:00
|
|
|
|
2022-03-09 20:25:02 +01:00
|
|
|
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
2022-02-10 22:32:40 +01:00
|
|
|
#endif
|