Receive individual slave status messages

This commit is contained in:
Jasper Blanckenburg 2023-05-14 19:52:24 +02:00
parent c54f3a65e3
commit bf11004c64
2 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@
#define CAN_ID_AMS_STATUS 0x00A
#define CAN_ID_AMS_IN 0x00B
#define CAN_ID_AMS_ERROR 0x00C
#define CAN_ID_SLAVE_STATUS 0x014
#define CAN_ID_SLAVE_STATUS_BASE 0x080
#define CAN_ID_SLAVE_LOG 0x4F4
#define CAN_ID_SHUNT_BASE 0x520
#define CAN_ID_SHUNT_CURRENT 0x521

View File

@ -15,7 +15,7 @@ void can_init(CAN_HandleTypeDef *handle) {
ftcan_add_filter(CAN_ID_SHUNT_BASE, 0xFF0);
ftcan_add_filter(CAN_ID_AMS_IN, 0xFFF);
ftcan_add_filter(CAN_ID_SLAVE_PANIC, 0xFFF);
ftcan_add_filter(CAN_ID_SLAVE_STATUS, 0xFFF);
ftcan_add_filter(CAN_ID_SLAVE_STATUS_BASE, 0xFF0);
ftcan_add_filter(CAN_ID_SLAVE_LOG, 0xFFF);
}
@ -39,14 +39,14 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
if ((id & 0xFF0) == CAN_ID_SHUNT_BASE) {
shunt_handle_can_msg(id, data);
return;
} else if ((id & 0xFF0) == CAN_ID_SLAVE_STATUS_BASE) {
slaves_handle_status(data);
return;
}
switch (id) {
case CAN_ID_SLAVE_PANIC:
slaves_handle_panic(data);
break;
case CAN_ID_SLAVE_STATUS:
slaves_handle_status(data);
break;
case CAN_ID_SLAVE_LOG:
slaves_handle_log(data);
break;