From a66c0887956f258952eae0843e4986e7cef67791 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 20 Jul 2026 15:11:27 -0700 Subject: [PATCH 1/3] try MADS --- board/health.h | 1 + board/main.c | 5 +++++ board/main_comms.h | 1 + 3 files changed, 7 insertions(+) diff --git a/board/health.h b/board/health.h index f585cd636b4..3c6a8c6034a 100644 --- a/board/health.h +++ b/board/health.h @@ -27,6 +27,7 @@ struct __attribute__((packed)) health_t { uint16_t sbu2_voltage_mV; uint8_t som_reset_triggered; uint16_t sound_output_level_pkt; + uint8_t controls_allowed_lateral_pkt; }; typedef struct __attribute__((packed)) { diff --git a/board/main.c b/board/main.c index ba60de57fd6..faa0d0e3930 100644 --- a/board/main.c +++ b/board/main.c @@ -207,6 +207,11 @@ static void tick_handler(void) { heartbeat_engaged_mismatches = 0U; } + // MADS lateral authorization has the same heartbeat fail-safe as normal controls. + if (controls_allowed_lateral && !heartbeat_engaged) { + controls_allowed_lateral = false; + } + if (!heartbeat_disabled) { // if the heartbeat has been gone for a while, go to SILENT safety mode and enter power save if (heartbeat_counter >= (started ? HEARTBEAT_IGNITION_CNT_ON : HEARTBEAT_IGNITION_CNT_OFF)) { diff --git a/board/main_comms.h b/board/main_comms.h index 8229a47ab9a..b2af06f607e 100644 --- a/board/main_comms.h +++ b/board/main_comms.h @@ -16,6 +16,7 @@ static int get_health_pkt(void *dat) { health->ignition_can_pkt = ignition_can; health->controls_allowed_pkt = controls_allowed; + health->controls_allowed_lateral_pkt = controls_allowed_lateral; health->safety_tx_blocked_pkt = safety_tx_blocked; health->safety_rx_invalid_pkt = safety_rx_invalid; health->tx_buffer_overflow_pkt = tx_buffer_overflow; From d79fb069e886052f9ff93edda0b6c8dfd5b82bd6 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 20 Jul 2026 15:29:09 -0700 Subject: [PATCH 2/3] expose lateral controls state --- python/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/__init__.py b/python/__init__.py index 4c954b23950..c2aeb0d7e02 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -543,6 +543,7 @@ def health(self): "sbu2_voltage_mV": a[23], "som_reset_triggered": a[24], "sound_output_level": a[25], + "controls_allowed_lateral": a[26], } @ensure_health_packet_version From 0c5fca7b24e21a4e9f87174ddd194e04e96e9e28 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 20 Jul 2026 16:47:42 -0700 Subject: [PATCH 3/3] clear MADS authorization on heartbeat disengage --- board/main_comms.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/board/main_comms.h b/board/main_comms.h index b2af06f607e..037963adae3 100644 --- a/board/main_comms.h +++ b/board/main_comms.h @@ -299,6 +299,9 @@ int comms_control_handler(ControlPacket_t *req, uint8_t *resp) { heartbeat_lost = false; heartbeat_disabled = false; heartbeat_engaged = (req->param1 == 1U); + if (!heartbeat_engaged) { + controls_allowed_lateral = false; + } break; } // **** 0xf6: set siren enabled