2024-05-30 23:38:05 +02:00
|
|
|
/**
|
|
|
|
* @file dtc.h
|
|
|
|
*
|
|
|
|
* @brief Header file for handling Diagnostic Trouble Codes (DTC) in the ChainLube application.
|
|
|
|
*
|
|
|
|
* This file provides definitions and functions for handling Diagnostic Trouble Codes (DTC)
|
|
|
|
* in the ChainLube project. It includes structures for DTC entries, severity levels,
|
|
|
|
* and functions for DTC maintenance and processing. DTCs are used to track system errors and issues.
|
|
|
|
*
|
|
|
|
* @author Marcel Peterkau
|
|
|
|
* @date 09.01.2024
|
|
|
|
*/
|
|
|
|
|
2022-04-14 22:48:11 +02:00
|
|
|
#ifndef _DTC_H_
|
|
|
|
#define _DTC_H_
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
2024-05-30 23:38:05 +02:00
|
|
|
#include "dtc_defs.h"
|
2022-04-14 22:48:11 +02:00
|
|
|
|
2023-04-13 01:28:41 +02:00
|
|
|
#define MAX_DTC_STORAGE 12
|
2022-04-14 22:48:11 +02:00
|
|
|
|
2024-05-30 23:38:05 +02:00
|
|
|
typedef struct
|
2022-04-14 22:48:11 +02:00
|
|
|
{
|
2024-05-30 23:38:05 +02:00
|
|
|
DTCNum_t Number;
|
2022-04-14 22:48:11 +02:00
|
|
|
uint32_t timestamp;
|
|
|
|
DTCActive_t active;
|
2023-02-20 13:51:54 +01:00
|
|
|
uint32_t debugVal;
|
2022-04-14 22:48:11 +02:00
|
|
|
} DTCEntry_t;
|
|
|
|
|
2024-05-30 23:38:05 +02:00
|
|
|
void MaintainDTC(DTCNum_t DTC_no, boolean active, uint32_t DebugValue = 0);
|
|
|
|
void ClearDTC(DTCNum_t DTC_no);
|
2022-04-14 22:48:11 +02:00
|
|
|
void ClearAllDTC();
|
2024-05-30 23:38:05 +02:00
|
|
|
DTCNum_t getlastDTC(boolean only_active);
|
|
|
|
DTCNum_t ActiveDTCseverity(DTCSeverity_t severity);
|
|
|
|
DTCSeverity_t getSeverityForDTC(DTCNum_t targetCode);
|
2023-04-13 00:35:24 +02:00
|
|
|
void DTC_Process();
|
2022-04-14 22:48:11 +02:00
|
|
|
|
2024-05-30 23:38:05 +02:00
|
|
|
extern DTCEntry_t DTCStorage[MAX_DTC_STORAGE];
|
2022-04-14 22:48:11 +02:00
|
|
|
#endif
|