Обновление
This commit is contained in:
parent
dee2d9ca08
commit
a8ca120cc3
73
LinTasks.c
73
LinTasks.c
|
|
@ -541,9 +541,13 @@ static bool setState20(tLinTaskActuator *env, bool isError, uint8_t index) {
|
||||||
env->linStateActuator[index].error_connect = 0;
|
env->linStateActuator[index].error_connect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env->linCommandActuator[index].isRFR_STA = 1;
|
||||||
|
|
||||||
if (env->linCommandActuator[index].BUS_ADR == 0x20) {
|
if (env->linCommandActuator[index].BUS_ADR == 0x20) {
|
||||||
for (uint8_t j = 0; j < LIN0_ISSR_ALL; ++j) {
|
for (uint8_t j = 0; j < LIN0_ISSR_ALL; ++j) {
|
||||||
|
|
||||||
env->linCommandActuator[j].COM = LIN_ACT_CFR_NONE;
|
env->linCommandActuator[j].COM = LIN_ACT_CFR_NONE;
|
||||||
|
env->linCommandActuator[j].isRFR_STA = 1;
|
||||||
|
|
||||||
if (isError) {
|
if (isError) {
|
||||||
env->linStateActuator[j].error_connect = 1;
|
env->linStateActuator[j].error_connect = 1;
|
||||||
|
|
@ -564,8 +568,6 @@ lin_event_id_t Lin0_Scheduler(tLinTaskActuator *env) {
|
||||||
|
|
||||||
for (uint8_t i = 0; i < LIN0_ISSR_ALL; ++i) {
|
for (uint8_t i = 0; i < LIN0_ISSR_ALL; ++i) {
|
||||||
|
|
||||||
env->linCommandActuator[i].isRFR_STA = 1;
|
|
||||||
|
|
||||||
if (env->linCommandActuator[i].COM == LIN_ACT_CFR_MOD) {
|
if (env->linCommandActuator[i].COM == LIN_ACT_CFR_MOD) {
|
||||||
|
|
||||||
ret = CFR_MOD_x(env->linIo, env->linData, env->linCommandActuator[i].BUS_ADR,
|
ret = CFR_MOD_x(env->linIo, env->linData, env->linCommandActuator[i].BUS_ADR,
|
||||||
|
|
@ -573,22 +575,14 @@ lin_event_id_t Lin0_Scheduler(tLinTaskActuator *env) {
|
||||||
|
|
||||||
if (ret == LIN_TX_COMPLETED) {
|
if (ret == LIN_TX_COMPLETED) {
|
||||||
|
|
||||||
if (env->linCommandActuator[i].BUS_ADR == 0x20) {
|
if (setState20(env, false, i))
|
||||||
|
break;
|
||||||
for (uint8_t j = 0; j < LIN0_ISSR_ALL; ++j) {
|
|
||||||
env->linCommandActuator[j].isRFR_STA = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (setState20(env, true, i))
|
if (setState20(env, true, i))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setState20(env, false, i))
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -602,13 +596,13 @@ lin_event_id_t Lin0_Scheduler(tLinTaskActuator *env) {
|
||||||
env->linCommandActuator[i].POS);
|
env->linCommandActuator[i].POS);
|
||||||
|
|
||||||
if (ret == LIN_TX_COMPLETED) {
|
if (ret == LIN_TX_COMPLETED) {
|
||||||
|
if (setState20(env, false, i))
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (setState20(env, true, i))
|
if (setState20(env, true, i))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setState20(env, false, i))
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -627,37 +621,37 @@ lin_event_id_t Lin0_Scheduler(tLinTaskActuator *env) {
|
||||||
env->linCommandActuator[i].Coils_Stop_SET);
|
env->linCommandActuator[i].Coils_Stop_SET);
|
||||||
|
|
||||||
if (ret == LIN_TX_COMPLETED) {
|
if (ret == LIN_TX_COMPLETED) {
|
||||||
|
if (setState20(env, false, i))
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (setState20(env, true, i))
|
if (setState20(env, true, i))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setState20(env, false, i))
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < LIN0_ISSR_ALL; ++i) {
|
for (uint8_t i = 0; i < LIN0_ISSR_ALL; ++i) {
|
||||||
|
|
||||||
uint8_t BLOCK_MT;
|
// uint8_t BLOCK_MT;
|
||||||
uint8_t DIAGNOSE_MT;
|
// uint8_t DIAGNOSE_MT;
|
||||||
uint16_t CPOS_ALL;
|
uint16_t CPOS_ALL;
|
||||||
|
|
||||||
ret = ISSR_x(env->linIo, env->linData,
|
// ret = ISSR_x(env->linIo, env->linData,
|
||||||
i,
|
// i,
|
||||||
&BLOCK_MT,
|
// &BLOCK_MT,
|
||||||
&CPOS_ALL,
|
// &CPOS_ALL,
|
||||||
&DIAGNOSE_MT);
|
// &DIAGNOSE_MT);
|
||||||
|
|
||||||
if (ret == LIN_RX_COMPLETED) {
|
// if (ret == LIN_RX_COMPLETED) {
|
||||||
|
|
||||||
env->linStateActuator[i].BLOCK_MT = BLOCK_MT;
|
// env->linStateActuator[i].BLOCK_MT = BLOCK_MT;
|
||||||
env->linStateActuator[i].CPOS_ALL = CPOS_ALL << 1;
|
// env->linStateActuator[i].CPOS_ALL = CPOS_ALL << 1;
|
||||||
env->linStateActuator[i].DIAGNOSE_MT = DIAGNOSE_MT;
|
// env->linStateActuator[i].DIAGNOSE_MT = DIAGNOSE_MT;
|
||||||
|
|
||||||
if ((env->linStateActuator[i].DIAGNOSE_MT) || (env->linCommandActuator[i].isRFR_STA)) {
|
// if ((env->linStateActuator[i].DIAGNOSE_MT) || (env->linCommandActuator[i].isRFR_STA)) {
|
||||||
|
if ((env->linCommandActuator[i].COM == LIN_ACT_CFR_NONE) || (env->linCommandActuator[i].isRFR_STA)) {
|
||||||
|
|
||||||
env->linCommandActuator[i].isRFR_STA = 0;
|
env->linCommandActuator[i].isRFR_STA = 0;
|
||||||
|
|
||||||
|
|
@ -713,9 +707,9 @@ lin_event_id_t Lin0_Scheduler(tLinTaskActuator *env) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
env->linStateActuator[i].error_connect = 1;
|
// env->linStateActuator[i].error_connect = 1;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret == LIN_TX_COMPLETED) || (ret == LIN_RX_COMPLETED)) {
|
if ((ret == LIN_TX_COMPLETED) || (ret == LIN_RX_COMPLETED)) {
|
||||||
|
|
@ -727,6 +721,19 @@ lin_event_id_t Lin0_Scheduler(tLinTaskActuator *env) {
|
||||||
return LIN_NO_EVENT;
|
return LIN_NO_EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void isEnterCommand(tLinTaskActuator *env) {
|
||||||
|
|
||||||
|
for (uint8_t j = 0; j < 5; ++j) {
|
||||||
|
for (uint8_t i = 0; i < LIN0_ISSR_ALL; ++i) {
|
||||||
|
if (env->linCommandActuator[i].COM != LIN_ACT_CFR_NONE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SystemDelayMs(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static _Noreturn void Lin0_Thread(tLinTaskActuator *env) {
|
static _Noreturn void Lin0_Thread(tLinTaskActuator *env) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
|
|
@ -748,7 +755,7 @@ static _Noreturn void Lin0_Thread(tLinTaskActuator *env) {
|
||||||
osMutexRelease(env->access);
|
osMutexRelease(env->access);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemDelayMs(100);
|
isEnterCommand(env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
#define HVAC_LIN_TASKS_H
|
#define HVAC_LIN_TASKS_H
|
||||||
|
|
||||||
#include <cmsis_os.h>
|
#include <cmsis_os.h>
|
||||||
|
#include "stdbool.h"
|
||||||
#include "LinIO.h"
|
#include "LinIO.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct __attribute__ ((packed)) {
|
typedef struct __attribute__ ((packed)) {
|
||||||
uint8_t BUS_ADR;
|
uint8_t BUS_ADR;
|
||||||
uint16_t INI_CPOS: 15;
|
uint16_t INI_CPOS: 15;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue