Обновление
This commit is contained in:
parent
9970b66742
commit
3938ca2994
|
|
@ -211,62 +211,66 @@ static void sendEventToCan(tCanSpamTransmitter *env) {
|
|||
env->can_id, env->canFrame.id_type, 100);
|
||||
}
|
||||
|
||||
static bool isEventTransmitter(tCanSpamTransmitter *env) {
|
||||
static eTimeEventTransmit isEventTransmitter(tCanSpamTransmitter *env) {
|
||||
|
||||
uint32_t timeMs = GetSystemTick();
|
||||
bool ret = false;
|
||||
env->timeMs = GetSystemTick();
|
||||
|
||||
|
||||
if (env->time_CCU_Stat1_CYC < timeMs) {
|
||||
env->time_CCU_Stat1_CYC = timeMs + CCU_Stat1_CYC;
|
||||
if (env->time_CCU_Stat1_CYC < env->timeMs) {
|
||||
env->time_CCU_Stat1_CYC = env->timeMs + CCU_Stat1_CYC;
|
||||
env->can_id = Pack_CCU_Stat1_candb(&ccu_candb_tx.CCU_Stat1, env->canFrame.data, &env->canFrame.dlc, &env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Stat1_CYC;
|
||||
}
|
||||
|
||||
if (env->time_CCU_Stat2_CYC < timeMs) {
|
||||
env->time_CCU_Stat2_CYC = timeMs + CCU_Stat2_CYC;
|
||||
if (env->time_CCU_Stat2_CYC < env->timeMs) {
|
||||
env->time_CCU_Stat2_CYC = env->timeMs + CCU_Stat2_CYC;
|
||||
env->can_id = Pack_CCU_Stat2_candb(&ccu_candb_tx.CCU_Stat2, env->canFrame.data, &env->canFrame.dlc, &env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Stat2_CYC;
|
||||
}
|
||||
|
||||
if (env->time_CCU_Stat3_CYC < timeMs) {
|
||||
env->time_CCU_Stat3_CYC = timeMs + CCU_Stat3_CYC;
|
||||
if (env->time_CCU_Stat3_CYC < env->timeMs) {
|
||||
env->time_CCU_Stat3_CYC = env->timeMs + CCU_Stat3_CYC;
|
||||
env->can_id = Pack_CCU_Stat3_candb(&ccu_candb_tx.CCU_Stat3, env->canFrame.data, &env->canFrame.dlc, &env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Stat3_CYC;
|
||||
}
|
||||
|
||||
if (env->time_CCU_Errors_CYC < timeMs) {
|
||||
env->time_CCU_Errors_CYC = timeMs + CCU_Errors_CYC;
|
||||
if (env->time_CCU_Errors_CYC < env->timeMs) {
|
||||
env->time_CCU_Errors_CYC = env->timeMs + CCU_Errors_CYC;
|
||||
env->can_id = Pack_CCU_Errors_candb(&ccu_candb_tx.CCU_Errors, env->canFrame.data, &env->canFrame.dlc,
|
||||
&env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Errors_CYC;
|
||||
}
|
||||
|
||||
|
||||
if (env->time_CCU_Requests < timeMs) {
|
||||
env->time_CCU_Requests = timeMs + CCU_Requests_CYC;
|
||||
if (env->time_CCU_Requests < env->timeMs) {
|
||||
env->time_CCU_Requests = env->timeMs + CCU_Requests_CYC;
|
||||
env->can_id = Pack_CCU_Requests_candb(&ccu_candb_tx.CCU_Requests, env->canFrame.data, &env->canFrame.dlc,
|
||||
&env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Requests;
|
||||
}
|
||||
|
||||
// начало--------------------------------------0x310 CCU_HVC_Req_Msg------------------------------------------------
|
||||
// начало--------------------------------------0x310 CCU_HVC_Req_Msg------------------------------------------------
|
||||
// начало--------------------------------------0x310 CCU_HVC_Req_Msg------------------------------------------------
|
||||
if (env->time_CCU_HVC_Req_Msg < timeMs) {
|
||||
env->time_CCU_HVC_Req_Msg = timeMs + CCU_HVC_Req_Msg_CYC;
|
||||
if (env->time_CCU_HVC_Req_Msg < env->timeMs) {
|
||||
env->time_CCU_HVC_Req_Msg = env->timeMs + CCU_HVC_Req_Msg_CYC;
|
||||
|
||||
CCU_HVC_Req_Msg(env);
|
||||
|
||||
env->can_id = Pack_CCU_HVC_Req_Msg_candb(&ccu_candb_tx.CCU_HVC_Req_Msg, env->canFrame.data, &env->canFrame.dlc,
|
||||
&env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_HVC_Req_Msg;
|
||||
}
|
||||
// конец---------------------------------------0x310 CCU_HVC_Req_Msg------------------------------------------------
|
||||
// конец---------------------------------------0x310 CCU_HVC_Req_Msg------------------------------------------------
|
||||
|
|
@ -275,13 +279,14 @@ static bool isEventTransmitter(tCanSpamTransmitter *env) {
|
|||
// начало--------------------------------------0x315 CCU_VCU_Msg1---------------------------------------------------
|
||||
// начало--------------------------------------0x315 CCU_VCU_Msg1---------------------------------------------------
|
||||
// начало--------------------------------------0x315 CCU_VCU_Msg1---------------------------------------------------
|
||||
if (env->time_CCU_VCU_Msg1 < timeMs) {
|
||||
env->time_CCU_VCU_Msg1 = timeMs + CCU_VCU_Msg1_CYC;
|
||||
if (env->time_CCU_VCU_Msg1 < env->timeMs) {
|
||||
env->time_CCU_VCU_Msg1 = env->timeMs + CCU_VCU_Msg1_CYC;
|
||||
|
||||
env->can_id = Pack_CCU_VCU_Msg1_candb(&ccu_candb_tx.CCU_VCU_Msg1, env->canFrame.data, &env->canFrame.dlc,
|
||||
&env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_VCU_Msg1;
|
||||
}
|
||||
// конец---------------------------------------0x315 CCU_VCU_Msg1---------------------------------------------------
|
||||
// конец---------------------------------------0x315 CCU_VCU_Msg1---------------------------------------------------
|
||||
|
|
@ -290,13 +295,14 @@ static bool isEventTransmitter(tCanSpamTransmitter *env) {
|
|||
// начало--------------------------------------0x316 CCU_VCU_Msg2---------------------------------------------------
|
||||
// начало--------------------------------------0x316 CCU_VCU_Msg2---------------------------------------------------
|
||||
// начало--------------------------------------0x316 CCU_VCU_Msg2---------------------------------------------------
|
||||
if (env->time_CCU_VCU_Msg2 < timeMs) {
|
||||
env->time_CCU_VCU_Msg2 = timeMs + CCU_VCU_Msg2_CYC;
|
||||
if (env->time_CCU_VCU_Msg2 < env->timeMs) {
|
||||
env->time_CCU_VCU_Msg2 = env->timeMs + CCU_VCU_Msg2_CYC;
|
||||
|
||||
env->can_id = Pack_CCU_VCU_Msg2_candb(&ccu_candb_tx.CCU_VCU_Msg2, env->canFrame.data, &env->canFrame.dlc,
|
||||
&env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_VCU_Msg2;
|
||||
}
|
||||
// конец---------------------------------------0x316 CCU_VCU_Msg2---------------------------------------------------
|
||||
// конец---------------------------------------0x316 CCU_VCU_Msg2---------------------------------------------------
|
||||
|
|
@ -305,12 +311,13 @@ static bool isEventTransmitter(tCanSpamTransmitter *env) {
|
|||
// начало--------------------------------------0x380 CCU_Msg1-------------------------------------------------------
|
||||
// начало--------------------------------------0x380 CCU_Msg1-------------------------------------------------------
|
||||
// начало--------------------------------------0x380 CCU_Msg1-------------------------------------------------------
|
||||
if (env->time_CCU_Msg1 < timeMs) {
|
||||
env->time_CCU_Msg1 = timeMs + CCU_Msg1_CYC;
|
||||
if (env->time_CCU_Msg1 < env->timeMs) {
|
||||
env->time_CCU_Msg1 = env->timeMs + CCU_Msg1_CYC;
|
||||
CCU_Msg1(env);
|
||||
env->can_id = Pack_CCU_Msg1_candb(&ccu_candb_tx.CCU_Msg1, env->canFrame.data, &env->canFrame.dlc, &env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Msg1;
|
||||
}
|
||||
// начало--------------------------------------0x380 CCU_Msg1-------------------------------------------------------
|
||||
// начало--------------------------------------0x380 CCU_Msg1-------------------------------------------------------
|
||||
|
|
@ -319,26 +326,28 @@ static bool isEventTransmitter(tCanSpamTransmitter *env) {
|
|||
// начало--------------------------------------0x501 CCU_Msg3-------------------------------------------------------
|
||||
// начало--------------------------------------0x501 CCU_Msg3-------------------------------------------------------
|
||||
// начало--------------------------------------0x501 CCU_Msg3-------------------------------------------------------
|
||||
if (env->time_CCU_Msg3 < timeMs) {
|
||||
env->time_CCU_Msg3 = timeMs + CCU_Msg3_CYC;
|
||||
if (env->time_CCU_Msg3 < env->timeMs) {
|
||||
env->time_CCU_Msg3 = env->timeMs + CCU_Msg3_CYC;
|
||||
CCU_Msg3(env);
|
||||
env->can_id = Pack_CCU_Msg3_candb(&ccu_candb_tx.CCU_Msg3, env->canFrame.data, &env->canFrame.dlc, &env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_Msg3;
|
||||
}
|
||||
// начало--------------------------------------0x501 CCU_Msg3-------------------------------------------------------
|
||||
// начало--------------------------------------0x501 CCU_Msg3-------------------------------------------------------
|
||||
// начало--------------------------------------0x501 CCU_Msg3-------------------------------------------------------
|
||||
|
||||
if (env->time_CCU_AC_Ctrl < timeMs) {
|
||||
env->time_CCU_AC_Ctrl = timeMs + CCU_AC_Ctrl_CYC;
|
||||
if (env->time_CCU_AC_Ctrl < env->timeMs) {
|
||||
env->time_CCU_AC_Ctrl = env->timeMs + CCU_AC_Ctrl_CYC;
|
||||
env->can_id = Pack_CCU_AC_Ctrl_candb(&ccu_candb_tx.CCU_AC_Ctrl, env->canFrame.data, &env->canFrame.dlc,
|
||||
&env->ide);
|
||||
sendEventToCan(env);
|
||||
ret = true;
|
||||
|
||||
|
||||
return event_CCU_AC_Ctrl;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return event_CCU_none;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -346,7 +355,8 @@ static _Noreturn void CanSpamTransmitter_Thread(tCanSpamTransmitter *env) {
|
|||
for (;;) {
|
||||
if (osMutexAcquire(env->access, 100) == osOK) {
|
||||
|
||||
while (isEventTransmitter(env) != false) {
|
||||
while (isEventTransmitter(env) != event_CCU_none) {
|
||||
sendEventToCan(env);
|
||||
}
|
||||
|
||||
osMutexRelease(env->access);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ typedef struct {
|
|||
can_rx_message_type canFrame;
|
||||
|
||||
uint32_t can_id;
|
||||
uint32_t timeMs;
|
||||
uint8_t ide;
|
||||
|
||||
uint32_t time_CCU_Stat1_CYC;
|
||||
|
|
|
|||
Loading…
Reference in New Issue