From 30dd1b6f4a490123021143f799e9f681e33a0b40 Mon Sep 17 00:00:00 2001 From: cfif Date: Fri, 23 Jan 2026 14:33:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DiagnosticTask.c | 327 +++++++++++++++++++++++++++++++++++++++++++++++ DiagnosticTask.h | 45 +++++++ StatusError.c | 147 ++++++++++++++++++++- StatusError.h | 62 ++++----- 4 files changed, 551 insertions(+), 30 deletions(-) create mode 100644 DiagnosticTask.c create mode 100644 DiagnosticTask.h diff --git a/DiagnosticTask.c b/DiagnosticTask.c new file mode 100644 index 0000000..94d6159 --- /dev/null +++ b/DiagnosticTask.c @@ -0,0 +1,327 @@ +// +// Created by cfif on 23.01.2026. +// +#include "DiagnosticTask.h" +#include "CmsisRtosThreadUtils.h" +#include "StatusData.h" +#include "StatusError.h" + + +void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger) { + + env->logger = logger; + + env->queue = osMessageQueueNew(DIAGNOSTIC_QUEUE_SIZE, 1, NULL); + + env->access = osMutexNew(NULL); + + for (uint8_t i = 0; i < COUNT_DTC_CODE_ERROR; ++i) { + + // Тест DTC не был выполнен в текущем цикле работы + dtc_state_error[i] = UDS_dtc_mask_testNotCompletedThisOperationCycle; + } + + InitThreadAtrStatic(&env->thread.attr, "Diagnostic", env->thread.controlBlock, env->thread.stack, + osPriorityNormal); +} + +void diagnostic_ClearDiagnosticInformation_14(tDiagnostic *env) { + for (uint8_t i = 0; i < COUNT_DTC_CODE_ERROR; ++i) { + // Тест DTC не был выполнен в текущем цикле работы + dtc_state_error[i] = UDS_dtc_mask_testNotCompletedThisOperationCycle; + // Тест DTC не был выполнен с момента последней очистки + dtc_state_error[i] |= UDS_dtc_mask_testNotCompletedSinceLastClear; + } +} + +const eDiagnosticState diagnostic_com[] = { + {diagnostic_ClearDiagnosticInformation_14, "DIAGNOSTIC_SET_UDS_ClearDiagnosticInformation_14"}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""}, + {NULL, ""} +}; + +void setDiagnosticData(tDiagnostic *env, eDiagnosticType diagnosticType) { + + if (diagnostic_com[diagnosticType].func != NULL) { + + if (osMutexAcquire(env->access, 1000) == osOK) { + diagnostic_com[diagnosticType].func(env); + osMutexRelease(env->access); + } + } + +} + +static _Noreturn void Diagnostic_Thread(tDiagnostic *env) { + for (;;) { + + osStatus_t status = osMessageQueueGet(env->queue, &env->diagnosticType, 0, 1000); + + if (status == osOK) { + if (osMutexAcquire(env->access, 1000) == osOK) { + + + osMutexRelease(env->access); + } + } + } +} + +void Diagnostic_StartThread(tDiagnostic *env) { + if (!env->thread.id) { + env->thread.id = osThreadNew((osThreadFunc_t) (Diagnostic_Thread), (void *) (env), &env->thread.attr); + } +} \ No newline at end of file diff --git a/DiagnosticTask.h b/DiagnosticTask.h new file mode 100644 index 0000000..8c3a4aa --- /dev/null +++ b/DiagnosticTask.h @@ -0,0 +1,45 @@ +// +// Created by cfif on 23.01.2026. +// + +#ifndef HVAC_M7_DIAGNOSTICTASK_H +#define HVAC_M7_DIAGNOSTICTASK_H + +#include +#include "LoggerInterface.h" + +#define DIAGNOSTIC_QUEUE_SIZE 10 + +typedef enum { + DIAGNOSTIC_SET_UDS_ClearDiagnosticInformation_14 = 0x00 +} eDiagnosticType; + +typedef struct { + osMutexId_t access; + osMessageQueueId_t queue; + eDiagnosticType diagnosticType; + tLoggerInterface *logger; + + struct { + osThreadId_t id; + uint32_t stack[512]; + StaticTask_t controlBlock; + osThreadAttr_t attr; + } thread; + +} tDiagnostic; + +typedef void (*diagnostic_func_ptr)(tDiagnostic *env); + +typedef struct { + diagnostic_func_ptr func; + char *desc; +} eDiagnosticState; + +void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger); + +void Diagnostic_StartThread(tDiagnostic *env); + +void setDiagnosticData(tDiagnostic *env, eDiagnosticType diagnosticType); + +#endif //HVAC_M7_DIAGNOSTICTASK_H diff --git a/StatusError.c b/StatusError.c index 4e0be81..4018fb2 100644 --- a/StatusError.c +++ b/StatusError.c @@ -1,4 +1,149 @@ // // Created by cfif on 05.12.2025. // -#include "StatusError.h" \ No newline at end of file +#include "StatusError.h" + + +// Бит Имя 0 1 +// 0 testFailed Не активно сейчас Активно сейчас +// 1 testFailedThisOperationCycle Не было в текущем цикле Было в текущем цикле +// 2 pendingDTC Не было в текущем/предыдущем цикле Было в текущем/предыдущем цикле +// 3 confirmedDTC Не подтверждено Подтверждено +// 4 testNotCompletedSinceLastClear Тест Выполнен с момента СБРОСА Тест НЕ выполнен с момента СБРОСА +// 5 testFailedSinceLastClear Не было с момента СБРОСА Было с момента СБРОСА обнаруживал неисправность (хотя бы один раз) с момента последнего сброса +// 6 testNotCompletedThisOperationCycle Тест Выполнен в текущем цикле Тест НЕ выполнен в текущем цикле +// 7 warningIndicatorRequested MIL не требуется MIL требуется + +// Массив DTC ошибок +uint8_t dtc_state_error[COUNT_DTC_CODE_ERROR]; + +// Структура DTC кодов +const tDTC_Entry dtc_codes[COUNT_DTC_CODE_ERROR] = { + {0xA0, 0x10, 0x1C, "CCU Power supply (BATTERY) - circuit voltage out of range"}, + {0xA0, 0x11, 0x1C, "Ignition(T30d) - circuit voltage out of range"}, + {0xA0, 0x20, 0x56, "Rear HVAC configuration - invalid / incompatible configuration; Aroma CCU configuration - invalid / incompatible configuration"}, + {0xA0, 0x30, 0x15, "Incar temperature sensor front left - circuit short to battery or open"}, + {0xA0, 0x30, 0x11, "Incar temperature sensor front left - circuit short to ground"}, + {0xA0, 0x31, 0x15, "Incar temperature sensor front right - circuit short to battery or open (reserve)"}, + {0xA0, 0x31, 0x11, "Incar temperature sensor front right - circuit short to ground (reserve)"}, + {0xA0, 0x54, 0x15, "Incar temperature sensor rear left - circuit short to battery or open"}, + {0xA0, 0x54, 0x11, "Incar temperature sensor rear left - circuit short to ground"}, + {0xA0, 0x55, 0x15, "Incar temperature sensor rear right - circuit short to battery or open"}, + {0xA0, 0x55, 0x11, "Incar temperature sensor rear right - circuit short to ground"}, + {0xA0, 0x32, 0x15, "Ambient Temperature Sensor - circuit short to battery or open"}, + {0xA0, 0x32, 0x11, "Ambient Temperature Sensor - circuit short to ground"}, + {0xA0, 0x33, 0x15, "Front Evaporator Temperature Sensor - circuit short to battery or open"}, + {0xA0, 0x33, 0x11, "Front Evaporator Temperature Sensor - circuit short to ground"}, + {0xA0, 0x34, 0x15, "Rear Evaporator Temperature Sensor - circuit short to battery or open"}, + {0xA0, 0x34, 0x11, "Rear Evaporator Temperature Sensor - circuit short to ground"}, + {0xA0, 0x35, 0x15, "Duct temperature sensor_VENT_FL - circuit short to battery or open"}, + {0xA0, 0x35, 0x11, "Duct temperature sensor_VENT_FL - circuit short to ground"}, + {0xA0, 0x36, 0x15, "Duct temperature sensor_VENT_FR - circuit short to battery or open"}, + {0xA0, 0x36, 0x11, "Duct temperature sensor_VENT_FR - circuit short to ground"}, + {0xA0, 0x37, 0x15, "Duct temperature sensor_FOOT_FL - circuit short to battery or open"}, + {0xA0, 0x37, 0x11, "Duct temperature sensor_FOOT_FL - circuit short to ground"}, + {0xA0, 0x38, 0x15, "Duct temperature sensor_FOOT_FR - circuit short to battery or open"}, + {0xA0, 0x38, 0x11, "Duct temperature sensor_FOOT_FR - circuit short to ground"}, + {0xA0, 0x41, 0x15, "Duct temperature sensor_VENT_SIDE_FL - circuit short to battery or open"}, + {0xA0, 0x41, 0x11, "Duct temperature sensor_VENT_SIDE_FL - circuit short to ground"}, + {0xA0, 0x42, 0x15, "Duct temperature sensor_VENT_SIDE_FR - circuit short to battery or open"}, + {0xA0, 0x42, 0x11, "Duct temperature sensor_VENT_SIDE_FR - circuit short to ground"}, + {0xA0, 0x39, 0x15, "Duct temperature sensor_VENT_RL - circuit short to battery or open"}, + {0xA0, 0x39, 0x11, "Duct temperature sensor_VENT_RL - circuit short to ground"}, + {0xA0, 0x40, 0x15, "Duct temperature sensor_VENT_RR - circuit short to battery or open"}, + {0xA0, 0x40, 0x11, "Duct temperature sensor_VENT_RR - circuit short to ground"}, + {0xA0, 0x45, 0x15, "Duct temperature sensor_FOOT_RL - circuit short to battery or open"}, + {0xA0, 0x45, 0x11, "Duct temperature sensor_FOOT_RL - circuit short to ground"}, + {0xA0, 0x46, 0x15, "Duct temperature sensor_FOOT_RR - circuit short to battery or open"}, + {0xA0, 0x46, 0x11, "Duct temperature sensor_FOOT_RR - circuit short to ground"}, + {0xA0, 0x47, 0x13, "Ultraviolet lamp - circuit open short to battery or open"}, + {0xA0, 0x47, 0x11, "Ultraviolet lamp - circuit short to ground"}, + {0xA0, 0x48, 0x13, "Aromatization - circuit open"}, + {0xA0, 0x48, 0x11, "Aromatization - circuit short to ground"}, + {0xA0, 0x48, 0x96, "Aromatization - component malfunction"}, + {0xA0, 0x49, 0x13, "Ionizer - circuit open"}, + {0xA0, 0x49, 0x11, "Ionizer - circuit short to ground"}, + {0xA0, 0x49, 0x96, "Ionizer - component malfunction"}, + {0xA0, 0x50, 0x96, "DRS for front zone - component malfunction"}, + {0xA0, 0x51, 0x96, "DRS for rear zone - component malfunction"}, + {0xA0, 0x43, 0x15, "Air Quality Sensor - circuit open"}, + {0xA0, 0x43, 0x11, "Air Quality Sensor - circuit short to ground"}, + {0xA0, 0x43, 0x96, "Air Quality Sensor - component malfunction"}, + {0xA0, 0x44, 0x12, "A/C Pressure sensor - circuit short to battery"}, + {0xA0, 0x44, 0x14, "A/C Pressure sensor - circuit short to ground or open"}, + {0xA0, 0x44, 0x84, "A/C Pressure sensor - signal below allowable range"}, + {0xA0, 0x56, 0x92, "Failure with front blower or thermal expansion valve - Performance or Incorrect Operation"}, + {0xA0, 0x58, 0x92, "Failure with rear blower or thermal expansion valve - Performance or Incorrect Operation"}, + {0xA0, 0x70, 0x04, "Defroster Gate Actuator(LIN 0::0) Position Not Reached"}, + {0xA0, 0x71, 0x04, "Recirculation Gate Actuator (LIN0::1) Position Not Reached"}, + {0xA0, 0x93, 0x04, "Recirculation OSA Gate Actuator (LIN0::2) Position Not Reached"}, + {0xA0, 0x72, 0x04, "Temp_Up_FL Gate Actuator (LIN0::3) Position Not Reached"}, + {0xA0, 0x73, 0x04, "Vent_CFL Gate Actuator (LIN0::4) Position Not Reached"}, + {0xA0, 0x74, 0x04, "Vent_SFL Gate Actuator (LIN0::5) Position Not Reached"}, + {0xA0, 0x75, 0x04, "Temp_Dn_FL Gate Actuator (LIN0::6) Position Not Reached"}, + {0xA0, 0x76, 0x04, "Foot_FL Gate Actuator (LIN0::7) Position Not Reached"}, + {0xA0, 0x77, 0x04, "Rear_Foot_FL Gate Actuator (LIN0::8) Position Not Reached"}, + {0xA0, 0x78, 0x04, "Temp_Up_FR Gate Actuator (LIN1::0) Position Not Reached"}, + {0xA0, 0x79, 0x04, "Vent_CFR Gate Actuator (LIN1::1) Position Not Reached"}, + {0xA0, 0x80, 0x04, "Vent_SFR Gate Actuator (LIN1::2) Position Not Reached"}, + {0xA0, 0x81, 0x04, "Temp_Dn_FR Gate Actuator (LIN1::3) Position Not Reached"}, + {0xA0, 0x82, 0x04, "Foot_FR Gate Actuator (LIN1::4) Position Not Reached"}, + {0xA0, 0x83, 0x04, "Rear_Foot_FR Gate Actuator (LIN1::5) Position Not Reached"}, + {0xA0, 0x84, 0x04, "Temp_RR Gate Actuator (LIN2::0) Position Not Reached"}, + {0xA0, 0x85, 0x04, "Temp_RL Gate Actuator (LIN2::1) Position Not Reached"}, + {0xA0, 0x86, 0x04, "Vent_SRL Gate Actuator (LIN2::3) Position Not Reached"}, + {0xA0, 0x87, 0x04, "Foot_RL Gate Actuator (LIN2::4) Position Not Reached"}, + {0xA0, 0x88, 0x04, "Vent_CRL Gate Actuator (LIN2::5) Position Not Reached"}, + {0xA0, 0x89, 0x04, "Vent_CRR Gate Actuator (LIN2::6) Position Not Reached"}, + {0xA0, 0x90, 0x04, "Foot_RR Gate Actuator (LIN2::7) Position Not Reached"}, + {0xA0, 0x91, 0x04, "Vent_SRR Gate Actuator (LIN2::8) Position Not Reached"}, + {0xA0, 0x92, 0x04, "Sealing Valve Gate Actuator (LIN2::9) Position Not Reached"}, + {0xC0, 0x28, 0x88, "Body CAN – bus off"}, + {0xC0, 0x37, 0x88, "HVAC CAN – bus off"}, + {0xC1, 0x00, 0x87, "Lost Communication With ECM/PCM \"A\" (EMS/VCU) - missing message"}, + {0xC1, 0x22, 0x87, "Lost Communication With Vehicle Dynamics Control Module (ESP) - missing message"}, + {0xC1, 0x41, 0x87, "Lost Communication With Body Control Module \"A\" - missing message"}, + {0xC1, 0x6B, 0x87, "Lost Communication With A/C Compressor Control Module - missing message"}, + {0xC1, 0x99, 0x87, "Lost Communication With \"Door Control Module A\" (DMFL) - missing message"}, + {0xC2, 0x00, 0x87, "Lost Communication With \"Door Control Module B\" (DMFR) - missing message"}, + {0xC2, 0x08, 0x87, "Lost Communication With \"Seat Control Module A\" (SMFL) - missing message"}, + {0xC2, 0x09, 0x87, "Lost Communication With \"Seat Control Module B\" (SMFR) - missing message"}, + {0xC2, 0x10, 0x87, "Lost Communication With \"Seat Control Module C\" (SMRL) - missing message"}, + {0xC2, 0x11, 0x87, "Lost Communication With \"Seat Control Module D\" (SMRR) - missing message"}, + {0xE2, 0xA1, 0x87, "Lost Communication With Trunk Module (TM) or Climate Control Panels Front&Rear (CCPF/CCPR) - missing message"}, + {0xE2, 0xA2, 0x87, "Lost Communication With Central Gateway (CGW) - missing message"}, + {0xE2, 0x30, 0x87, "Defroster Gate Actuator(LIN 0::0) - Missing Message"}, + {0xE2, 0x31, 0x87, "Recirculation Gate Actuator (LIN0::1) - Missing Message"}, + {0xE2, 0x62, 0x87, "Recirculation OSA Gate Actuator (LIN0::2) - Missing Message"}, + {0xE2, 0x32, 0x87, "Temp_Up_FL Gate Actuator (LIN0::3) - Missing Message"}, + {0xE2, 0x33, 0x87, "Vent_CFL Gate Actuator (LIN0::4) - Missing Message"}, + {0xE2, 0x34, 0x87, "Foot_FR Gate Actuator (LIN1::5) - Missing Message"}, + {0xE2, 0x35, 0x87, "Temp_Dn_FL Gate Actuator (LIN0::6) - Missing Message"}, + {0xE2, 0x36, 0x87, "Foot_FL Gate Actuator (LIN0::7) - Missing Message"}, + {0xE2, 0x37, 0x87, "Rear_Foot_FL Gate Actuator (LIN0::8) - Missing Message"}, + {0xE2, 0x38, 0x87, "Temp_Up_FR Gate Actuator (LIN1::1) - Missing Message"}, + {0xE2, 0x39, 0x87, "Vent_CFR Gate Actuator (LIN1::2) - Missing Message"}, + {0xE2, 0x40, 0x87, "Vent_SFR Gate Actuator (LIN1::3) - Missing Message"}, + {0xE2, 0x41, 0x87, "Temp_Dn_FR Gate Actuator (LIN1::4) - Missing Message"}, + {0xE2, 0x42, 0x87, "Foot_FR Gate Actuator (LIN1::5) - Missing Message"}, + {0xE2, 0x43, 0x87, "Rear_Foot_FR Gate Actuator (LIN1::6) - Missing Message"}, + {0xE2, 0x44, 0x87, "Temp_RR Gate Actuator (LIN2::1) - Missing Message"}, + {0xE2, 0x45, 0x87, "Temp_RL Gate Actuator (LIN2::2) - Missing Message"}, + {0xE2, 0x46, 0x87, "Vent_SRL Gate Actuator (LIN2::3) - Missing Message"}, + {0xE2, 0x47, 0x87, "Temp_RL Gate Actuator (LIN2::4) - Missing Message"}, + {0xE2, 0x48, 0x87, "Vent_CRL Gate Actuator (LIN2::5) - Missing Message"}, + {0xE2, 0x49, 0x87, "Vent_CRR Gate Actuator (LIN2::6) - Missing Message"}, + {0xE2, 0x50, 0x87, "Foot_RR Gate Actuator (LIN2::7) - Missing Message"}, + {0xE2, 0x51, 0x87, "Vent_SRR Gate Actuator (LIN2::8) - Missing Message"}, + {0xE2, 0x52, 0x87, "Sealing Valve Gate Actuator (LIN2::9) - Missing Message"}, + {0xE2, 0x53, 0x87, "Air quality sensor (LIN3) - Missing Message"}, + {0xE2, 0x54, 0x87, "Ionizer (LIN3) - Missing Message"}, + {0xE2, 0x55, 0x87, "Aromatization (LIN3) - Missing Message"}, + {0xE2, 0x56, 0x87, "Front TXV (LIN3) - Missing Message"}, + {0xE2, 0x57, 0x87, "Rear TXV (LIN3) - Missing Message"}, + {0xE2, 0x58, 0x87, "High voltage battery chiller TXV (LIN3) - Missing Message"}, + {0xE2, 0x59, 0x87, "Heat pump chiller TXV (LIN3) - Missing Message"}, + {0xE2, 0x60, 0x87, "DRS for front zone (LIN4) - Missing Message"}, + {0xE2, 0x61, 0x87, "DRS for rear zone (LIN4) - Missing Message"}, + {0xF0, 0x02, 0x56, "Vehicle Identification Number - invalid / incompatible configuration"} +}; \ No newline at end of file diff --git a/StatusError.h b/StatusError.h index 37ff280..dc82c84 100644 --- a/StatusError.h +++ b/StatusError.h @@ -6,36 +6,40 @@ #define HVAC_M7_STATUSERROR_H #include "stdint.h" -uint8_t DTC_CODE_ERROR[127]; -const uint32_t DTC_CODE_HEX[] = { - 0xA0101C, 0xA0111C, 0xA02056, 0xA03015, 0xA03011, - 0xA03115, 0xA03111, 0xA05415, 0xA05411, 0xA05515, - 0xA05511, 0xA03215, 0xA03211, 0xA03315, 0xA03311, - 0xA03415, 0xA03411, 0xA03515, 0xA03511, 0xA03615, - 0xA03611, 0xA03715, 0xA03711, 0xA03815, 0xA03811, - 0xA04115, 0xA04111, 0xA04215, 0xA04211, 0xA03915, - 0xA03911, 0xA04015, 0xA04011, 0xA04515, 0xA04511, - 0xA04615, 0xA04611, 0xA04713, 0xA04711, 0xA04813, - 0xA04811, 0xA04896, 0xA04913, 0xA04911, 0xA04996, - 0xA05096, 0xA05196, 0xA04313, 0xA04311, 0xA04396, - 0xA04412, 0xA04414, 0xA04484, 0xA05692, 0xA05892, - 0xA07004, 0xA07104, 0xA09304, 0xA07204, 0xA07304, - 0xA07404, 0xA07504, 0xA07604, 0xA07704, 0xA07804, - 0xA07904, 0xA08004, 0xA08104, 0xA08204, 0xA08304, - 0xA08404, 0xA08504, 0xA08604, 0xA08704, 0xA08804, - 0xA08904, 0xA09004, 0xA09104, 0xA09204, 0xC02888, - 0xC03788, 0xC10087, 0xC12287, 0xC14187, 0xC16B87, - 0xC19987, 0xC20087, 0xC20887, 0xC20987, 0xC21087, - 0xC21187, 0xE2A187, 0xE2A287, 0xE23087, 0xE23187, - 0xE26287, 0xE23287, 0xE23387, 0xE23487, 0xE23587, - 0xE23687, 0xE23787, 0xE23887, 0xE23987, 0xE24087, - 0xE24187, 0xE24287, 0xE24387, 0xE24487, 0xE24587, - 0xE24687, 0xE24787, 0xE24887, 0xE24987, 0xE25087, - 0xE25187, 0xE25287, 0xE25387, 0xE25487, 0xE25587, - 0xE25687, 0xE25787, 0xE25887, 0xE25987, 0xE26087, - 0xE26187, 0xF00256 -}; +typedef struct { + uint8_t DTCHighByte; // Старший байт DTC кода (первые 2 символа) + uint8_t DTCMiddleByte; // Средний байт DTC кода (следующие 2 символа) + uint8_t DTCLowByte; // Младший байт DTC кода (последние 2 символа) + char *description; // Описание ошибки +} tDTC_Entry; + +typedef struct { + uint8_t testFailed : 1; // DTC является активным на момент запроса (Временное) + uint8_t testFailedThisOperationCycle; // DTC был активным в текущем цикле работы (Временное) + uint8_t pendingDTC : 1; // DTC был активным в текущем или предыдущем цикле (Временное) + uint8_t confirmedDTC : 1; // DTC подтвержден (Постоянное) + uint8_t testNotCompletedSinceLastClear : 1; // Тест DTC не был выполнен с момента последней очистки (Временное) + uint8_t testFailedSinceLastClear : 1; // Тест DTC обнаруживал неисправность хотя бы раз с момента последней очистки (Временное) + uint8_t testNotCompletedThisOperationCycle : 1; // Тест DTC не был выполнен в текущем цикле работы (Временное) + uint8_t warningIndicatorRequested : 1; // Сервер запрашивает включение индикатора предупреждения (Временное) +} tUdsDTCStatusMask; + +typedef enum { + UDS_dtc_mask_testFailed = 0x1, // DTC является активным на момент запроса (Временное) + UDS_dtc_mask_testFailedThisOperationCycle = 0x2, // DTC был активным в текущем цикле работы (Временное) + UDS_dtc_mask_pendingDTC = 0x4, // DTC был активным в текущем или предыдущем цикле (Временное) + UDS_dtc_mask_confirmedDTC = 0x8, // DTC подтвержден (Постоянное) + UDS_dtc_mask_testNotCompletedSinceLastClear = 0x10, // Тест DTC не был выполнен с момента последней очистки (Временное) + UDS_dtc_mask_testFailedSinceLastClear = 0x20, // Тест DTC обнаруживал неисправность хотя бы раз с момента последней очистки (Временное) + UDS_dtc_mask_testNotCompletedThisOperationCycle = 0x40, // Тест DTC не был выполнен в текущем цикле работы (Временное) + UDS_dtc_mask_warningIndicatorRequested = 0x80 // Сервер запрашивает включение индикатора предупреждения (Временное) +} eUdsDTCMask; + +#define COUNT_DTC_CODE_ERROR 127 + +extern const tDTC_Entry dtc_codes[COUNT_DTC_CODE_ERROR]; +extern uint8_t dtc_state_error[COUNT_DTC_CODE_ERROR]; //# ErrorCode HexCode FTB SAE J2012 Symptom Description DTC description HW Comment Pre-Condtion Maturation Failure Threshold Maturation Time De-Maturation Failure Threshold De-Maturation Time Degrade mode / Fail-safe action Malfunction Indicator Remark Comment SW progress //1 B20101C A0101C 0x1C Voltage Out of Range CCU Power supply (BATTERY) - circuit voltage out of range Possible T30d_state = "1" and T15_state = "1" 6.0v > VIN or VIN > 18.0V t > 3sec 6.0v < VIN and VIN < 18.0V t > 1 sec Only DTC Set * If voltage of battery is under 7.0v/7.5v or over 17.5v/18.0v, 1) Actuator Stop 2) Blower Stop 3) Seat Module Stop Request None Condition * If voltage of battery is under 7.0v/7.5v or over 17.5v/18.0v, --> * If voltage of battery is under 7.5v/8.0v or over 17.0v/17.5v OK : DTC / Fail-Safe