nicht wirklich schönere Fixes für FSN

This commit is contained in:
2025-07-12 18:15:44 +02:00
parent fb3eba0a09
commit aee7f4f697
3 changed files with 21 additions and 14 deletions

View File

@ -6,7 +6,6 @@
#include "can-halal.h"
extern int can_ams_last_tick;
extern TSState request_state;
HAL_StatusTypeDef can_init(FDCAN_HandleTypeDef* handle) {
TRY(ftcan_init(handle));
@ -18,9 +17,9 @@ HAL_StatusTypeDef can_init(FDCAN_HandleTypeDef* handle) {
HAL_StatusTypeDef can_update_state(){
uint8_t data;
if (request_state == TS_ACTIVE){
if (ts_state.target_state == TS_ACTIVE){
data = 0x01;
} else if (request_state == TS_INACTIVE) {
} else if (ts_state.target_state == TS_INACTIVE) {
data = 0x00;
} else {
return HAL_ERROR;
@ -38,6 +37,7 @@ void ftcan_msg_received_cb(uint16_t id, size_t len, const uint8_t* data) {
case CAN_ID_AMS_SIGNALS:
break;
case CAN_ID_AMS_ERROR:
ts_state.target_state = TS_INACTIVE;
break;
default:
break;