State transition can msg handling

This commit is contained in:
@CarlWachter 2024-01-04 16:55:21 +01:00
parent a66565e984
commit 243d52f71e

View File

@ -20,6 +20,9 @@
#include <sta/rtos/system/can_bus.hpp> #include <sta/rtos/system/can_bus.hpp>
#include <sta/tacos/can_bus.hpp> #include <sta/tacos/can_bus.hpp>
#include <sta/config.hpp>
#include <sta/tacos/statemachine.hpp>
#include <cmsis_os2.h> #include <cmsis_os2.h>
#include <FreeRTOS.h> #include <FreeRTOS.h>
@ -87,7 +90,19 @@ namespace dummy
debug::printFrameID(header.id); debug::printFrameID(header.id);
debug::printPayloadHex(payload, header.payloadLength); debug::printPayloadHex(payload, header.payloadLength);
// TODO Forward message to other threads // Sysmessage is mainly only state change from GRSM
// TODO add other cases
// 0 is from state, 1 is to state, 2 is lockout, 3 is failsafe (-1 if inactive)
if(payload[1] > 0 && payload[1] < STA_TACOS_NUM_STATES){
if(payload[3] == -1){
sta::tacos::Statemachine::instance()->requestStateTransition(payload[0], payload[1], payload[2]);
}
else{
sta::tacos::Statemachine::instance()->requestTimedStateTransition(payload[0], payload[1], payload[2], payload[3]);
}
}
} }
void handleDataMessage(const sta::IsotpMessage & msg) void handleDataMessage(const sta::IsotpMessage & msg)