From c5df4d7b79ef4873c9c35476b0029c780427e9cb Mon Sep 17 00:00:00 2001 From: Jasper Date: Mon, 14 Mar 2022 16:27:52 +0100 Subject: [PATCH] Use one fewer CAN mailbox --- lib/FT_2018_STW_CAN/FT_2018_STW_CAN.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/FT_2018_STW_CAN/FT_2018_STW_CAN.cpp b/lib/FT_2018_STW_CAN/FT_2018_STW_CAN.cpp index 3f61686..3b8244e 100644 --- a/lib/FT_2018_STW_CAN/FT_2018_STW_CAN.cpp +++ b/lib/FT_2018_STW_CAN/FT_2018_STW_CAN.cpp @@ -19,8 +19,10 @@ void Init_Can_0() { Can0.setNumTXBoxes(1); // reserves mailbox 0 for tx only 8 mailboxes are // available (the other 7 mailboxes are for rx) - Can0.watchFor(CAN_ID_BCU_APS_BRAKE); - Can0.watchFor(CAN_ID_BCU_ETC); + // We only have 7 mailboxes, but want to receive 8 messages. This trick should + // allow us to receive BCU_APS_BRAKE and BCU_ETC in the same mailbox. + Can0.watchFor(CAN_ID_BCU_APS_BRAKE & CAN_ID_BCU_ETC, + ~(CAN_ID_BCU_APS_BRAKE ^ CAN_ID_BCU_ETC)); Can0.watchFor(CAN_ID_BCU_SHIFT_CTRL); Can0.watchFor(CAN_ID_BCU_LAP_TIME); Can0.watchFor(CAN_ID_MS4_IGN_REV_ATH);