// // Created by cfif on 12.02.2026. // #ifndef HVAC_M7_LINSENSORTASKS_H #define HVAC_M7_LINSENSORTASKS_H #include #include "stdbool.h" #include "LinIO.h" #include "LoggerInterface.h" #define LOG_LIN4_ACTUATOR 1 #define LOG_LIN5_ACTUATOR 1 #define AirQS_Stat 0x14 #define Aroma_Stat 0x5 #define CCU_Req 0x1 #define Ionizer_Stat 0x1C #define eTXV_fHVAC_Stat 0x1E #define eTXV_rHVAC_Stat 0x20 #define eTXV_batChiller_Stat 0x22 #define eTXV_eeChiller_Stat 0x24 #define CCU_DRS_Req 0x1 #define DRS_DL_Stat 0xD #define DRS_DR_Stat 0x12 #define DRS_FCL_Stat 0x2B #define DRS_FCR_Stat 0x30 #define DRS_FPL_Stat 0x17 #define DRS_FPR_Stat 0x1C #define DRS_RLB_Stat 0x21 #define DRS_RRB_Stat 0x26 typedef struct __attribute__ ((packed)) { uint8_t AirQS_LinRespErr_Stat: 1; // 0 uint8_t AirQS_Sens_Stat: 2; // 1 uint8_t AirQS_Combined_Stat: 3; // 3 uint8_t unused1: 2; // 6 uint8_t AirQS_Err_Stat: 3; // 8 uint8_t AirQS_COLvl_Stat: 4; // 11 uint8_t unused2: 1; // 15 uint8_t AirQS_NOxLvl_Stat: 4; // 16 uint8_t AirQS_NH3Lvl_Stat: 4; // 20 } tAirQS_Stat; typedef struct __attribute__ ((packed)) { uint8_t Aroma_LinRespErr_Stat: 1; // 0 uint8_t Aroma_CartridgeSw_Stat: 1; // 1 uint8_t unused1: 2; // 2 uint8_t Aroma_Err_Stat: 2; // 4 uint8_t Aroma_Intens_Stat: 2; // 6 uint8_t unused2: 2; // 8 uint8_t Aroma_CartridgeFlavor_Stat: 4; // 10 uint16_t unused3: 10; // биты 14–23 uint8_t Aroma_CartridgeCapacity_Stat: 4; // 24 uint8_t unused4: 4; // биты 28–31 uint8_t unused5: 8; // биты 32–39 } tAroma_Stat; typedef struct __attribute__ ((packed)) { uint8_t CCU_Ionization_Req: 1; // 0 uint8_t unused1: 2; // 1 uint8_t CCU_AromaIntens_Req: 2; // 3 uint8_t unused2: 3; // биты 5–7 uint8_t unused3: 8; // биты 8–15 uint8_t unused4: 8; // биты 16–23 uint8_t CCU_AirQS_Req: 1; // 24 uint8_t CCU_fHVAC_Pos_Val: 7; // 25 uint8_t CCU_rHVAC_Pos_Val: 7; // 32 uint8_t unused5: 1; // 39 uint8_t CCU_batChiller_Pos_Val: 7; // 40 uint8_t unused6: 1; // 47 uint8_t CCU_eeChiller_Pos_Val: 7; // 48 uint8_t unused7: 1; // 55 – явное заполнение } tCCU_Req; typedef struct __attribute__ ((packed)) { uint8_t Ionizer_LinRespErr_Stat: 1; // 0 uint8_t Ionizer_Err_Stat: 2; // 1 uint8_t unused1: 5; // 3 uint8_t Ionizer_Ionization_Stat: 1; // 8 } tIonizer_Stat; typedef struct __attribute__ ((packed)) { uint8_t eTXV_fHVAC_Pos_Stat: 7; // 0 uint8_t eTXV_fHVAC_LinRespErr_Stat: 1; // 7 uint8_t eTXV_fHVAC_Err_Stat: 2; // 8 uint8_t eTXV_fHVAC_Pressure_Val: 6; // 10 uint8_t eTXV_fHVAC_Temp_Val: 7; // 16 } teTXV_fHVAC_Stat; typedef struct __attribute__ ((packed)) { uint8_t eTXV_rHVAC_Pos_Stat: 7; // 0 uint8_t eTXV_rHVAC_LinRespErr_Stat: 1; // 7 uint8_t eTXV_rHVAC_Err_Stat: 2; // 8 uint8_t eTXV_rHVAC_Pressure_Val: 6; // 10 uint8_t eTXV_rHVAC_Temp_Val: 7; // 16 } teTXV_rHVAC_Stat; typedef struct __attribute__ ((packed)) { uint8_t eTXV_batChiller_Pos_Stat : 7; // 0 uint8_t eTXV_batChiller_LinRespErr_Stat : 1; // 7 uint8_t eTXV_batChiller_Err_Stat : 2; // 8 uint8_t eTXV_batChiller_Pressure_Val : 6; // 10 uint8_t eTXV_batChiller_Temp_Val : 7; // 16 } teTXV_batChiller_Stat; typedef struct __attribute__ ((packed)) { uint8_t eTXV_eeChiller_Stat_: 7; // 0 uint8_t eTXV_eeChiller_LinRespErr_Stat: 1; // 7 uint8_t eTXV_eeChiller_Err_Stat: 2; // 8 uint8_t eTXV_eeChiller_Pressure_Val: 6; // 10 uint8_t eTXV_eeChiller_Temp_Val: 7; // 16 } teTXV_eeChiller_Stat; typedef struct __attribute__ ((packed)) { uint8_t CCU_DLLed1_Req: 1; // 0 uint8_t CCU_DLLed2_Req: 1; // 1 uint8_t CCU_DLLed3_Req: 1; // 2 uint8_t CCU_DRLed1_Req: 1; // 3 uint8_t CCU_DRLed2_Req: 1; // 4 uint8_t CCU_DRLed3_Req: 1; // 5 uint8_t CCU_FPLLed1_Req: 1; // 6 uint8_t CCU_FPLLed2_Req: 1; // 7 uint8_t CCU_FPLLed3_Req: 1; // 8 uint8_t CCU_FPRLed1_Req: 1; // 9 uint8_t CCU_FPRLed2_Req: 1; // 10 uint8_t CCU_FPRLed3_Req: 1; // 11 uint8_t CCU_RLBLed1_Req: 1; // 12 uint8_t CCU_RLBLed2_Req: 1; // 13 uint8_t CCU_RLBLed3_Req: 1; // 14 uint8_t CCU_RRBLed1_Req: 1; // 15 uint8_t CCU_RRBLed2_Req: 1; // 16 uint8_t CCU_RRBLed3_Req: 1; // 17 uint8_t CCU_FCLLed1_Req: 1; // 18 uint8_t CCU_FCLLed2_Req: 1; // 19 uint8_t CCU_FCLLed3_Req: 1; // 20 uint8_t CCU_FCRLed1_Req: 1; // 21 uint8_t CCU_FCRLed2_Req: 1; // 22 uint8_t CCU_FCRLed3_Req: 1; // 23 uint8_t BCM_SwIndIntens_Stat: 1; // 24 uint8_t BCM_IndFadingTime_Req: 5; // 25 } tCCU_DRS_Req; typedef struct __attribute__ ((packed)) { uint8_t DRS_Btn_Stat: 1; // 0 uint8_t DRS_LinRespErr_Stat: 1; // 1 uint8_t DRS_Err_Stat: 1; // 2 } tDRS_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_DL_Btn_Stat: 1; // 0 uint8_t DRS_DL_LinRespErr_Stat: 1; // 1 uint8_t DRS_DL_Err_Stat: 1; // 2 } tDRS_DL_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_DR_Btn_Stat: 1; // 0 uint8_t DRS_DR_LinRespErr_Stat: 1; // 1 uint8_t DRS_DR_Err_Stat: 1; // 2 } tDRS_DR_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_FCL_Btn_Stat: 1; // 0 uint8_t DRS_FCL_LinRespErr_Stat: 1; // 1 uint8_t DRS_FCL_Err_Stat: 1; // 2 } tDRS_FCL_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_FCR_Btn_Stat: 1; // 0 uint8_t DRS_FCR_LinRespErr_Stat: 1; // 1 uint8_t DRS_FCR_Err_Stat: 1; // 2 } tDRS_FCR_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_FPL_Btn_Stat: 1; // 0 uint8_t DRS_FPL_LinRespErr_Stat: 1; // 1 uint8_t DRS_FPL_Err_Stat: 1; // 2 } tDRS_FPL_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_FPR_Btn_Stat: 1; // 0 uint8_t DRS_FPR_LinRespErr_Stat: 1; // 1 uint8_t DRS_FPR_Err_Stat: 1; // 2 } tDRS_FPR_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_RLB_Btn_Stat: 1; // 0 uint8_t DRS_RLB_LinRespErr_Stat: 1; // 1 uint8_t DRS_RLB_Err_Stat: 1; // 2 } tDRS_RLB_Stat; typedef struct __attribute__ ((packed)) { uint8_t DRS_RRB_Btn_Stat: 1; // 0 uint8_t DRS_RRB_LinRespErr_Stat: 1; // 1 uint8_t DRS_RRB_Err_Stat: 1; // 2 } tDRS_RRB_Stat; typedef struct { tLinIO *linIo; osMutexId_t access; tLinData *linData; tLoggerInterface *logger; tCCU_Req d_CCU_Req; tAirQS_Stat d_AirQS_Stat; struct { osThreadId_t id; uint32_t stack[1024]; StaticTask_t controlBlock; osThreadAttr_t attr; } threadLin; } tLin4TaskSensor; typedef struct { tLinIO *linIo; osMutexId_t access; tLinData *linData; tLoggerInterface *logger; tDRS_Stat d_DRS_DL_Stat; tDRS_Stat d_DRS_DR_Stat; tDRS_Stat d_DRS_FCL_Stat; tDRS_Stat d_DRS_FCR_Stat; tDRS_Stat d_DRS_FPL_Stat; tDRS_Stat d_DRS_FPR_Stat; tDRS_Stat d_DRS_RLB_Stat; tDRS_Stat d_DRS_RRB_Stat; tCCU_DRS_Req d_CCU_DRS_Req; struct { osThreadId_t id; uint32_t stack[1024]; StaticTask_t controlBlock; osThreadAttr_t attr; } threadLin; } tLin5TaskSensor; void Lin_4_Init(tLin4TaskSensor *env, tLinData *linData, tLinIO *linIO, tLoggerInterface *logger); void Lin4_StartThread(tLin4TaskSensor *env); void Lin_5_Init(tLin5TaskSensor *env, tLinData *linData, tLinIO *linIO, tLoggerInterface *logger); void Lin5_StartThread(tLin5TaskSensor *env); #endif //HVAC_M7_LINSENSORTASKS_H