From 77ecf515e55750b1e2dc0fc60b04fe3fd3ec13a3 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 4 Jun 2024 18:11:21 -0700 Subject: [PATCH] clear stuck CAN messages before switching multiplexing (#1967) * clear stuck CAN messages before switching multiplexing * todo --- board/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/main.c b/board/main.c index 4bd784bf..b481c28b 100644 --- a/board/main.c +++ b/board/main.c @@ -97,6 +97,9 @@ void set_safety_mode(uint16_t mode, uint16_t param) { heartbeat_counter = 0U; heartbeat_lost = false; if (current_board->has_obd) { + // Clear any pending messages in the can core (i.e. sending while comma power is unplugged) + // TODO: rewrite using hardware queues rather than fifo to cancel specific messages + llcan_clear_send(CANIF_FROM_CAN_NUM(1)); if (param == 0U) { current_board->set_can_mode(CAN_MODE_OBD_CAN2); } else {