workaround for EE24 Delay in IRQ

This commit is contained in:
2024-04-30 11:19:08 +02:00
parent a23a0f5a6d
commit 2934954396

23
CLS.c
View File

@@ -8,6 +8,9 @@
osTimerId_t CLS_HeatbeatTimerId = NULL; // Timer ID
static CLS_HeatbeatData_t cls_heatbeat_data = {0};
static uint8_t EventChangeTypeData[2] ={0};
static CLS_Type_t newType = 0;
static CLS_Position_t newPostion = {0};
static bool writeNewSetting = false;
_Static_assert(sizeof(cls_heatbeat_data) == 8, "CLS_HeatbeatData_t is not 8 bytes");
@@ -17,6 +20,12 @@ void CLS_Heatbeat(void *argument) {
CLS_BSP_TxHeaderType cls_hartbeat_header = CREATE_BSP_CAN_HEADER(GENERATE_CLS_ADDRESS(CLS_CODE_STATUS,gCLS_DEVICE_ADDRESS,CLS_CH_STA_HEATBEAT), CLS_BSP_DLC_BYTES_8);
cls_heatbeat_data.counter++;
CLS_BSP_CAN_AddMessageToSend(&cls_hartbeat_header, (uint8_t*)&cls_heatbeat_data);
if (writeNewSetting) {
CLS_BSP_SetDeviceType(newType);
CLS_BSP_SetPosition(newPostion);
writeNewSetting = false;
}
}
void CLS_SendEventChangeTypePostion(CanDataId canid, CLS_Type_t newType, CLS_Position_t newPostion) {
@@ -29,15 +38,11 @@ void CLS_SendEventChangeTypePostion(CanDataId canid, CLS_Type_t newType, CLS_Pos
void CLS_OnEventChangeTypePostion(CanDataId canid, uint8_t* data, uint8_t len) {
if (len > 0) {
CLS_BSP_SetDeviceType((CLS_Type_t) data[0]);
}
if(len >1) {
CLS_Position_t pos;
pos.p0 = (data[1] & 0x0F);
pos.p1 = ((data[1] >> 4) & 0x0F);
CLS_BSP_SetPosition(pos);
if(len >= 2) {
newType = data[0];
newPostion.p0 = (data[1] & 0x0F);
newPostion.p1 = ((data[1] >> 4) & 0x0F);
writeNewSetting = true;
}
}