TOYOTA: add bus checks to tx_hook
TOYOTA: add bus checks to tx_hook
@@ -31,6 +31,9 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
+ // Check if msg is sent on BUS 0
+ if (((to_send->RDTR >> 4) & 0xF) == 0) {
+
// ACCEL: safety check on byte 1-2
if ((to_send->RIR>>21) == 0x343) {
int16_t desired_accel = ((to_send->RDLR & 0xFF) << 8) | ((to_send->RDLR >> 8) & 0xFF);
@@ -72,6 +75,7 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return 0;
}
}
+ }
// 1 allows the message through
return true;
