HVAC_M7_MONO/MODULES/HVAC_M7_StatusData/DiagnosticTask.h

84 lines
2.3 KiB
C

//
// Created by cfif on 23.01.2026.
//
#ifndef HVAC_M7_DIAGNOSTICTASK_H
#define HVAC_M7_DIAGNOSTICTASK_H
#include <cmsis_os.h>
#include "LoggerInterface.h"
#include "ccu_candb-binutil.h"
#include "CanSpamReceiver.h"
#include "lfs.h"
#define LOG_DTC 0
#define V_DIAG_LOW 95
#define V_DIAG_HIGH 155
#define V_SEND_LOW 90
#define V_SEND_HIGH 150
#define DTC_TEST_FAILED 1
#define DTC_TEST_CONFIRMED 8
#define DTC_TEST_FAILED_CONFIRMED (DTC_TEST_FAILED | DTC_TEST_CONFIRMED)
#define TDiagStart 500
typedef struct {
uint8_t mask;
uint8_t *dataResponse;
} tDiagnosticDTC;
typedef struct {
osMutexId_t access;
tLoggerInterface *logger;
uint32_t tDiagStart;
tCanSpamReceiver *canSpamReceiver;
bool isNoBitsDTC;
bool isCleanDTC;
struct {
bool isT15;
bool isT30d;
uint16_t P_BATT;
CCU_Errors_t *CCU_Errors;
uint8_t *dtc_state_error_model;
char *VIN;
ccu_candb_error_missing_rx_t *CAN_ERROR_MISSING;
ccu_candb_time_missing_rx_t *CAN_TIME_MISSING;
uint8_t *LIN1_ERROR_MISSING;
uint8_t *LIN2_ERROR_MISSING;
uint8_t *LIN3_ERROR_MISSING;
uint8_t *LIN4_ERROR_MISSING;
uint8_t *LIN5_ERROR_MISSING;
uint8_t d_DTC_AROMATIZATION_OPEN;
uint8_t d_DTC_AROMATIZATION_SHORT_GND;
uint8_t d_DTC_AROMATIZATION_MALFUNCTION;
uint8_t d_DTC_AIR_QUALITY_SENSOR_OPEN;
uint8_t d_DTC_AIR_QUALITY_SENSOR_SHORT_GND;
uint8_t d_DTC_AIR_QUALITY_SENSOR_MALFUNCTION;
uint8_t d_DTC_IONIZER_OPEN;
uint8_t d_DTC_IONIZER_SHORT_GND;
uint8_t d_DTC_IONIZER_MALFUNCTION;
uint8_t d_DTC_DRS_FRONT_ZONE_MALFUNCTION;
uint8_t d_DTC_DRS_REAR_ZONE_MALFUNCTION;
} state;
} tDiagnostic;
void Diagnostic_Init(tDiagnostic *env, tCanSpamReceiver *canSpamReceiver, tLoggerInterface *logger);
void set_NoBitsDTC(tDiagnostic *env, bool noBitsDTC);
void set_Dtc_state(tDiagnostic *env);
uint32_t diagnostic_ClearDiagnosticInformation_14(tDiagnostic *env);
uint32_t diagnostic_UDS_ReadDTCInformation_19_count(tDiagnostic *env, tDiagnosticDTC *diagnosticDTC);
uint32_t diagnostic_UDS_ReadDTCInformation_19_dtc(tDiagnostic *env, tDiagnosticDTC *diagnosticDTC);
uint32_t diagnostic_UDS_ReadDTCSupportDTC_19_dtc(tDiagnostic *env, tDiagnosticDTC *diagnosticDTC);
#endif //HVAC_M7_DIAGNOSTICTASK_H