Обновление
This commit is contained in:
parent
aedd2c0e23
commit
0cb993667f
|
|
@ -14,12 +14,18 @@
|
|||
#define LOG_SIGN5 "Lin5"
|
||||
#define LOGGER env->logger
|
||||
|
||||
const uint8_t DRS_SENSON_ADR_Stat[LIN5_SENSOR_COUNT] = {DRS_DL_Stat, DRS_DR_Stat, DRS_FCL_Stat, DRS_FCR_Stat,
|
||||
DRS_FPL_Stat, DRS_FPR_Stat, DRS_RLB_Stat, DRS_RRB_Stat};
|
||||
const uint8_t DRS_SENSON_ADR_Stat[LIN5_SENSOR_COUNT] = {DRS_DL_Stat,
|
||||
DRS_DR_Stat,
|
||||
DRS_FPL_Stat,
|
||||
DRS_FPR_Stat,
|
||||
DRS_RLB_Stat,
|
||||
DRS_RRB_Stat,
|
||||
DRS_FCL_Stat,
|
||||
DRS_FCR_Stat};
|
||||
|
||||
static lin_event_id_t SEND_SENSOR_COM_x(tLinIO *linIo, uint8_t COM_ADR) {
|
||||
lin_event_id_t res = linIo->runCommand(linIo->env, COM_ADR, 40);
|
||||
SystemDelayMs(30);
|
||||
lin_event_id_t res = linIo->runCommand(linIo->env, COM_ADR, 30);
|
||||
SystemDelayMs(40);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -39,8 +45,6 @@ static lin_event_id_t Set_CCU_Req(tLinIO *linIo, tLinData *linData, tCCU_Req *p_
|
|||
|
||||
res = SEND_SENSOR_COM_x(linIo, CCU_Req);
|
||||
|
||||
SystemDelayMs(50);
|
||||
|
||||
if (res == LIN_TX_COMPLETED) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -56,7 +60,7 @@ static lin_event_id_t Get_AirQS_Stat(tLinIO *linIo, tLinData *linData, tAirQS_St
|
|||
|
||||
tAirQS_Stat *tAirQS_Stat_ = (tAirQS_Stat *) linData->g_aRxBuffer;
|
||||
|
||||
uint8_t retry = 3;
|
||||
uint8_t retry = 1;
|
||||
|
||||
while (retry) {
|
||||
|
||||
|
|
@ -185,8 +189,6 @@ static lin_event_id_t Set_CCU_DRS_Req(tLinIO *linIo, tLinData *linData, tCCU_DRS
|
|||
|
||||
res = SEND_SENSOR_COM_x(linIo, CCU_DRS_Req);
|
||||
|
||||
SystemDelayMs(50);
|
||||
|
||||
if (res == LIN_TX_COMPLETED) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -256,9 +258,28 @@ static lin_event_id_t Get_DRS_Stat(tLinIO *linIo, tLinData *linData, tDRS_Stat *
|
|||
// в соответствии со значением count (0, 1, 2, 3)
|
||||
static void set_led_group(tCCU_DRS_Req *req, uint8_t led_group, uint8_t count) {
|
||||
// Определяем, какой из трёх битов должен быть установлен
|
||||
uint8_t b1 = (count == 1) ? 1 : 0;
|
||||
uint8_t b2 = (count == 2) ? 1 : 0;
|
||||
uint8_t b3 = (count == 3) ? 1 : 0;
|
||||
|
||||
uint8_t b1 = 0;
|
||||
uint8_t b2 = 0;
|
||||
uint8_t b3 = 0;
|
||||
|
||||
if (count == 1) {
|
||||
b1 = 1;
|
||||
b2 = 0;
|
||||
b3 = 0;
|
||||
}
|
||||
|
||||
if (count == 2) {
|
||||
b1 = 1;
|
||||
b2 = 1;
|
||||
b3 = 0;
|
||||
}
|
||||
|
||||
if (count == 3) {
|
||||
b1 = 1;
|
||||
b2 = 1;
|
||||
b3 = 1;
|
||||
}
|
||||
|
||||
switch (led_group) {
|
||||
case 0:
|
||||
|
|
@ -345,22 +366,21 @@ static lin_event_id_t Lin5_Scheduler(tLin5TaskSensor *env) {
|
|||
for (uint8_t i = 0; i < LIN5_SENSOR_COUNT; ++i) {
|
||||
set_led_group(&env->d_CCU_DRS_Req, i, env->LED_COUNT[i]);
|
||||
}
|
||||
env->d_CCU_DRS_Req.BCM_SwIndIntens_Stat = 0;
|
||||
env->d_CCU_DRS_Req.BCM_SwIndIntens_Stat = 1;
|
||||
env->d_CCU_DRS_Req.BCM_IndFadingTime_Req = 2;
|
||||
|
||||
ret = Set_CCU_DRS_Req(env->linIo, env->linData, &env->d_CCU_DRS_Req);
|
||||
|
||||
if (*((uint32_t *) &env->d_CCU_DRS_Req) != *((uint32_t *) &env->d_old_CCU_DRS_Req)) {
|
||||
*((uint32_t *) &env->d_old_CCU_DRS_Req) = *((uint32_t *) &env->d_CCU_DRS_Req);
|
||||
ret = Set_CCU_DRS_Req(env->linIo, env->linData, &env->d_CCU_DRS_Req);
|
||||
|
||||
#if (LOG_LIN5_SENSOR == 1)
|
||||
if (ret == LIN_TX_COMPLETED) {
|
||||
// LoggerFormatInfo(LOGGER, LOG_SIGN5, "OK Set_CCU_DRS_Req = %d", ret)
|
||||
} else {
|
||||
LoggerFormatInfo(LOGGER, LOG_SIGN5, "Sensor Set_CCU_DRS_Req (ERROR %d)", ret)
|
||||
}
|
||||
if (ret == LIN_TX_COMPLETED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN5, "Sensor Set_CCU_DRS_Req - OK")
|
||||
} else {
|
||||
LoggerFormatInfo(LOGGER, LOG_SIGN5, "Sensor Set_CCU_DRS_Req (ERROR %d)", ret)
|
||||
}
|
||||
#endif
|
||||
|
||||
SystemDelayMs(50);
|
||||
|
||||
}
|
||||
|
||||
return LIN_NO_EVENT;
|
||||
}
|
||||
|
|
@ -391,7 +411,7 @@ static _Noreturn void Lin5_Thread(tLin5TaskSensor *env) {
|
|||
osMutexRelease(env->access);
|
||||
}
|
||||
|
||||
SystemDelayMs(10);
|
||||
SystemDelayMs(50);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,12 +27,14 @@
|
|||
#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
|
||||
#define DRS_FCL_Stat 0x2B
|
||||
#define DRS_FCR_Stat 0x30
|
||||
|
||||
|
||||
|
||||
typedef struct __attribute__ ((packed)) {
|
||||
uint8_t AirQS_LinRespErr_Stat: 1; // 0
|
||||
|
|
@ -241,24 +243,12 @@ typedef struct {
|
|||
|
||||
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;
|
||||
*/
|
||||
tDRS_Stat d_DRS_Stat[LIN5_SENSOR_COUNT];
|
||||
|
||||
uint8_t LED_COUNT[LIN5_SENSOR_COUNT];
|
||||
uint8_t LED_STATE_1[LIN5_SENSOR_COUNT];
|
||||
uint8_t LED_STATE_2[LIN5_SENSOR_COUNT];
|
||||
uint8_t LED_STATE_3[LIN5_SENSOR_COUNT];
|
||||
|
||||
tCCU_DRS_Req d_CCU_DRS_Req;
|
||||
tCCU_DRS_Req d_old_CCU_DRS_Req;
|
||||
|
||||
struct {
|
||||
osThreadId_t id;
|
||||
|
|
|
|||
Loading…
Reference in New Issue