Обновление
This commit is contained in:
parent
a4179952fd
commit
42c7178cd3
239
LinSensorTasks.c
239
LinSensorTasks.c
|
|
@ -194,6 +194,7 @@ static lin_event_id_t Set_CCU_DRS_Req(tLinIO *linIo, tLinData *linData, tCCU_DRS
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static lin_event_id_t Get_DRS_DL_Stat(tLinIO *linIo, tLinData *linData, tDRS_DL_Stat *p_tDRS_DL_Stat) {
|
static lin_event_id_t Get_DRS_DL_Stat(tLinIO *linIo, tLinData *linData, tDRS_DL_Stat *p_tDRS_DL_Stat) {
|
||||||
lin_event_id_t res;
|
lin_event_id_t res;
|
||||||
|
|
||||||
|
|
@ -220,23 +221,229 @@ static lin_event_id_t Get_DRS_DL_Stat(tLinIO *linIo, tLinData *linData, tDRS_DL_
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
static lin_event_id_t Get_DRS_Stat(tLinIO *linIo, tLinData *linData, tDRS_Stat *p_tDRS_Stat, uint8_t DRS_stat) {
|
||||||
|
lin_event_id_t res;
|
||||||
|
|
||||||
|
tDRS_Stat *tDRS_Stat_ = (tDRS_Stat *) linData->g_aRxBuffer;
|
||||||
|
|
||||||
|
uint8_t retry = 3;
|
||||||
|
|
||||||
|
while (retry) {
|
||||||
|
|
||||||
|
linData->direction = LIN_DIRECTION_GET;
|
||||||
|
|
||||||
|
linData->g_aTxBufferLen = 0;
|
||||||
|
linData->g_aRxBufferLen = sizeof(tDRS_Stat);
|
||||||
|
|
||||||
|
res = SEND_SENSOR_COM_x(linIo, DRS_stat);
|
||||||
|
|
||||||
|
if (res == LIN_RX_COMPLETED) {
|
||||||
|
memcpy(p_tDRS_Stat, tDRS_Stat_, sizeof(tDRS_Stat));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
--retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t led = 0;
|
|
||||||
|
|
||||||
static lin_event_id_t Lin5_Scheduler(tLin5TaskSensor *env) {
|
static lin_event_id_t Lin5_Scheduler(tLin5TaskSensor *env) {
|
||||||
lin_event_id_t ret = LIN_NO_EVENT;
|
lin_event_id_t ret = LIN_NO_EVENT;
|
||||||
|
|
||||||
|
static uint32_t step = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
// ---------------------------------------- d_DRS_DL_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_DL_Stat, DRS_DL_Stat);
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_DL_Btn_Stat = %d DRS_DL_LinRespErr_Stat = %d DRS_DL_Err_Stat = %d",
|
||||||
|
env->d_DRS_DL_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_DL_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_DL_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_DL_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------- d_DRS_DR_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_DR_Stat, DRS_DR_Stat);
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_DR_Btn_Stat = %d DRS_DR_LinRespErr_Stat = %d DRS_DR_Err_Stat = %d",
|
||||||
|
env->d_DRS_DR_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_DR_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_DR_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_DR_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------- d_DRS_FCL_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_FCL_Stat, DRS_FCL_Stat);
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_FCL_Btn_Stat = %d DRS_FCL_LinRespErr_Stat = %d DRS_FCL_Err_Stat = %d",
|
||||||
|
env->d_DRS_FCL_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_FCL_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_FCL_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_FCL_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------- d_DRS_FCR_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_FCR_Stat, DRS_FCR_Stat);
|
||||||
|
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_FCR_Btn_Stat = %d DRS_FCR_LinRespErr_Stat = %d DRS_FCR_Err_Stat = %d",
|
||||||
|
env->d_DRS_FCR_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_FCR_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_FCR_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_FCR_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ---------------------------------------- d_DRS_FPL_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_FPL_Stat, DRS_FPL_Stat);
|
||||||
|
|
||||||
|
if (env->d_DRS_FPL_Stat.DRS_Btn_Stat) {
|
||||||
|
step = 0;
|
||||||
|
}
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_FPL_Btn_Stat = %d DRS_FPL_LinRespErr_Stat = %d DRS_FPL_Err_Stat = %d",
|
||||||
|
env->d_DRS_FPL_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_FPL_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_FPL_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_FPL_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
// ---------------------------------------- d_DRS_FPR_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_FPR_Stat, DRS_FPR_Stat);
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_FPR_Btn_Stat = %d DRS_FPR_LinRespErr_Stat = %d DRS_FPR_Err_Stat = %d",
|
||||||
|
env->d_DRS_FPR_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_FPR_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_FPR_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_FPR_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------- d_DRS_RLB_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_RLB_Stat, DRS_RLB_Stat);
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_RLB_Btn_Stat = %d DRS_RLB_LinRespErr_Stat = %d DRS_RLB_Err_Stat = %d",
|
||||||
|
env->d_DRS_RLB_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_RLB_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_RLB_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_RLB_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------- d_DRS_RRB_Stat ----------------------------------------------------------
|
||||||
|
ret = Get_DRS_Stat(env->linIo, env->linData, &env->d_DRS_RRB_Stat, DRS_RRB_Stat);
|
||||||
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
|
|
||||||
|
if (ret == LIN_RX_COMPLETED) {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
||||||
|
"DRS_RRB_Btn_Stat = %d DRS_RRB_LinRespErr_Stat = %d DRS_RRB_Err_Stat = %d",
|
||||||
|
env->d_DRS_RRB_Stat.DRS_Btn_Stat,
|
||||||
|
env->d_DRS_RRB_Stat.DRS_LinRespErr_Stat,
|
||||||
|
env->d_DRS_RRB_Stat.DRS_Err_Stat
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_RRB_Stat = %d", ret)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (step <= 3) {
|
||||||
|
|
||||||
|
uint8_t led1 = 0;
|
||||||
|
uint8_t led2 = 0;
|
||||||
|
uint8_t led3 = 0;
|
||||||
|
|
||||||
|
++step;
|
||||||
|
|
||||||
|
if (step == 1) {
|
||||||
|
led1 = 1;
|
||||||
|
led2 = 0;
|
||||||
|
led3 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 2) {
|
||||||
|
led1 = 0;
|
||||||
|
led2 = 1;
|
||||||
|
led3 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 3) {
|
||||||
|
led1 = 0;
|
||||||
|
led2 = 0;
|
||||||
|
led3 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step == 4) {
|
||||||
|
led1 = 0;
|
||||||
|
led2 = 0;
|
||||||
|
led3 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
env->d_CCU_DRS_Req.CCU_FPLLed1_Req = led1;
|
||||||
|
env->d_CCU_DRS_Req.CCU_FPLLed2_Req = led2;
|
||||||
|
env->d_CCU_DRS_Req.CCU_FPLLed3_Req = led3;
|
||||||
|
|
||||||
|
env->d_CCU_DRS_Req.BCM_SwIndIntens_Stat = 0;
|
||||||
|
|
||||||
|
env->d_CCU_DRS_Req.BCM_IndFadingTime_Req = 2;
|
||||||
|
|
||||||
env->d_CCU_DRS_Req.CCU_DLLed1_Req = led;
|
|
||||||
ret = Set_CCU_DRS_Req(env->linIo, env->linData, &env->d_CCU_DRS_Req);
|
ret = Set_CCU_DRS_Req(env->linIo, env->linData, &env->d_CCU_DRS_Req);
|
||||||
|
|
||||||
if (led == 0) {
|
|
||||||
led = 1;
|
|
||||||
} else {
|
|
||||||
led = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (LOG_LIN5_ACTUATOR == 1)
|
#if (LOG_LIN5_ACTUATOR == 1)
|
||||||
if (ret == LIN_TX_COMPLETED) {
|
if (ret == LIN_TX_COMPLETED) {
|
||||||
|
|
@ -246,24 +453,10 @@ static lin_event_id_t Lin5_Scheduler(tLin5TaskSensor *env) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SystemDelayMs(50);
|
||||||
|
|
||||||
ret = Get_DRS_DL_Stat(env->linIo, env->linData, &env->d_DRS_DL_Stat);
|
|
||||||
|
|
||||||
#if (LOG_LIN5_ACTUATOR == 1)
|
|
||||||
|
|
||||||
if (ret == LIN_RX_COMPLETED) {
|
|
||||||
LoggerFormatInfo(LOGGER, LOG_SIGN5,
|
|
||||||
"DRS_DL_Btn_Stat = %d DRS_DL_LinRespErr_Stat = %d DRS_DL_Err_Stat = %d",
|
|
||||||
env->d_DRS_DL_Stat.DRS_DL_Btn_Stat,
|
|
||||||
env->d_DRS_DL_Stat.DRS_DL_LinRespErr_Stat,
|
|
||||||
env->d_DRS_DL_Stat.DRS_DL_Err_Stat
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
LoggerFormatInfo(LOGGER, LOG_SIGN5, "ERROR Get_DRS_DL_Stat = %d", ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return LIN_NO_EVENT;
|
return LIN_NO_EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +486,7 @@ static _Noreturn void Lin5_Thread(tLin5TaskSensor *env) {
|
||||||
osMutexRelease(env->access);
|
osMutexRelease(env->access);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDelayMs(1000);
|
SystemDelayMs(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "LoggerInterface.h"
|
#include "LoggerInterface.h"
|
||||||
|
|
||||||
#define LOG_LIN4_ACTUATOR 1
|
#define LOG_LIN4_ACTUATOR 1
|
||||||
#define LOG_LIN5_ACTUATOR 1
|
#define LOG_LIN5_ACTUATOR 0
|
||||||
|
|
||||||
#define AirQS_Stat 0x14
|
#define AirQS_Stat 0x14
|
||||||
#define Aroma_Stat 0x5
|
#define Aroma_Stat 0x5
|
||||||
|
|
@ -119,31 +119,45 @@ typedef struct __attribute__ ((packed)) {
|
||||||
uint8_t CCU_DLLed1_Req: 1; // 0
|
uint8_t CCU_DLLed1_Req: 1; // 0
|
||||||
uint8_t CCU_DLLed2_Req: 1; // 1
|
uint8_t CCU_DLLed2_Req: 1; // 1
|
||||||
uint8_t CCU_DLLed3_Req: 1; // 2
|
uint8_t CCU_DLLed3_Req: 1; // 2
|
||||||
|
|
||||||
uint8_t CCU_DRLed1_Req: 1; // 3
|
uint8_t CCU_DRLed1_Req: 1; // 3
|
||||||
uint8_t CCU_DRLed2_Req: 1; // 4
|
uint8_t CCU_DRLed2_Req: 1; // 4
|
||||||
uint8_t CCU_DRLed3_Req: 1; // 5
|
uint8_t CCU_DRLed3_Req: 1; // 5
|
||||||
|
|
||||||
uint8_t CCU_FPLLed1_Req: 1; // 6
|
uint8_t CCU_FPLLed1_Req: 1; // 6
|
||||||
uint8_t CCU_FPLLed2_Req: 1; // 7
|
uint8_t CCU_FPLLed2_Req: 1; // 7
|
||||||
uint8_t CCU_FPLLed3_Req: 1; // 8
|
uint8_t CCU_FPLLed3_Req: 1; // 8
|
||||||
|
|
||||||
uint8_t CCU_FPRLed1_Req: 1; // 9
|
uint8_t CCU_FPRLed1_Req: 1; // 9
|
||||||
uint8_t CCU_FPRLed2_Req: 1; // 10
|
uint8_t CCU_FPRLed2_Req: 1; // 10
|
||||||
uint8_t CCU_FPRLed3_Req: 1; // 11
|
uint8_t CCU_FPRLed3_Req: 1; // 11
|
||||||
|
|
||||||
uint8_t CCU_RLBLed1_Req: 1; // 12
|
uint8_t CCU_RLBLed1_Req: 1; // 12
|
||||||
uint8_t CCU_RLBLed2_Req: 1; // 13
|
uint8_t CCU_RLBLed2_Req: 1; // 13
|
||||||
uint8_t CCU_RLBLed3_Req: 1; // 14
|
uint8_t CCU_RLBLed3_Req: 1; // 14
|
||||||
|
|
||||||
uint8_t CCU_RRBLed1_Req: 1; // 15
|
uint8_t CCU_RRBLed1_Req: 1; // 15
|
||||||
uint8_t CCU_RRBLed2_Req: 1; // 16
|
uint8_t CCU_RRBLed2_Req: 1; // 16
|
||||||
uint8_t CCU_RRBLed3_Req: 1; // 17
|
uint8_t CCU_RRBLed3_Req: 1; // 17
|
||||||
|
|
||||||
uint8_t CCU_FCLLed1_Req: 1; // 18
|
uint8_t CCU_FCLLed1_Req: 1; // 18
|
||||||
uint8_t CCU_FCLLed2_Req: 1; // 19
|
uint8_t CCU_FCLLed2_Req: 1; // 19
|
||||||
uint8_t CCU_FCLLed3_Req: 1; // 20
|
uint8_t CCU_FCLLed3_Req: 1; // 20
|
||||||
|
|
||||||
uint8_t CCU_FCRLed1_Req: 1; // 21
|
uint8_t CCU_FCRLed1_Req: 1; // 21
|
||||||
uint8_t CCU_FCRLed2_Req: 1; // 22
|
uint8_t CCU_FCRLed2_Req: 1; // 22
|
||||||
uint8_t CCU_FCRLed3_Req: 1; // 23
|
uint8_t CCU_FCRLed3_Req: 1; // 23
|
||||||
|
|
||||||
uint8_t BCM_SwIndIntens_Stat: 1; // 24
|
uint8_t BCM_SwIndIntens_Stat: 1; // 24
|
||||||
uint8_t BCM_IndFadingTime_Req: 5; // 25
|
uint8_t BCM_IndFadingTime_Req: 5; // 25
|
||||||
} tCCU_DRS_Req;
|
} 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)) {
|
typedef struct __attribute__ ((packed)) {
|
||||||
uint8_t DRS_DL_Btn_Stat: 1; // 0
|
uint8_t DRS_DL_Btn_Stat: 1; // 0
|
||||||
uint8_t DRS_DL_LinRespErr_Stat: 1; // 1
|
uint8_t DRS_DL_LinRespErr_Stat: 1; // 1
|
||||||
|
|
@ -225,7 +239,15 @@ typedef struct {
|
||||||
|
|
||||||
tLoggerInterface *logger;
|
tLoggerInterface *logger;
|
||||||
|
|
||||||
tDRS_DL_Stat d_DRS_DL_Stat;
|
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;
|
tCCU_DRS_Req d_CCU_DRS_Req;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue