From 67ad32c0f5c2fb274511749444e42a72f567dec0 Mon Sep 17 00:00:00 2001 From: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Date: Tue, 3 Feb 2026 01:14:14 -0500 Subject: [PATCH] Dash Parity Gen2 ACC Pedal_Long Revert "Dash Parity Gen2 ACC Pedal_Long" This reverts commit beeea0514c98bf06f7e3ade8e850f5e49363c6c8. Reapply "Dash Parity Gen2 ACC Pedal_Long" This reverts commit 060ec8f5feda491c501677c3f6cc6ad76776d694. --- panda/board/safety/safety_gm.h | 31 ++++++++++++++++++++++++++++++- selfdrive/car/gm/carcontroller.py | 5 +++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/panda/board/safety/safety_gm.h b/panda/board/safety/safety_gm.h index cef67afadd..84832d3683 100644 --- a/panda/board/safety/safety_gm.h +++ b/panda/board/safety/safety_gm.h @@ -172,6 +172,13 @@ static void gm_rx_hook(const CANPacket_t *to_push) { } } + // Cruise check for ACC models with pedal interceptor - block stock ACC + if ((addr == 0x1C4) && gm_has_acc && enable_gas_interceptor) { + // When pedal interceptor is active on ACC models, ignore stock cruise state + // to prevent conflicts between pedal interceptor and stock ACC + cruise_engaged_prev = false; + } + if (addr == 0xBD) { regen_braking = (GET_BYTE(to_push, 0) >> 4) != 0U; } @@ -192,6 +199,12 @@ static void gm_rx_hook(const CANPacket_t *to_push) { } generic_rx_checks(stock_ecu_detected); } + // Cruise check for Gen2 Bolt (ASCMActiveCruiseControlStatus on bus 2) + int addr = GET_ADDR(to_push); + if ((addr == 0x370) && (GET_BUS(to_push) == 2U)) { + bool cruise_engaged = (GET_BYTE(to_push, 2) >> 7) != 0U; // ACCCmdActive + cruise_engaged_prev = cruise_engaged; + } } static bool gm_tx_hook(const CANPacket_t *to_send) { @@ -246,6 +259,11 @@ static bool gm_tx_hook(const CANPacket_t *to_send) { int button = (GET_BYTE(to_send, 5) >> 4) & 0x7U; bool allowed_btn = (button == GM_BTN_CANCEL) && cruise_engaged_prev; + // For ACC cars with pedal interceptor, allow cancel even if cruise_engaged_prev is false + // (since we set it to false to prevent conflicts, but still need to cancel cruise) + if (gm_hw == GM_CAM && enable_gas_interceptor && button == GM_BTN_CANCEL) { + allowed_btn = true; + } // For standard CC, allow spamming of SET / RESUME if (gm_cc_long) { allowed_btn |= cruise_engaged_prev && (button == GM_BTN_SET || button == GM_BTN_RESUME || button == GM_BTN_UNPRESS); @@ -272,6 +290,7 @@ static bool gm_tx_hook(const CANPacket_t *to_send) { tx = false; } } + return tx; } @@ -291,7 +310,14 @@ static int gm_fwd_hook(int bus_num, int addr) { // block lkas message and acc messages if gm_cam_long, forward all others bool is_lkas_msg = (addr == 0x180); bool is_acc_msg = (addr == 0x315) || (addr == 0x2CB) || (addr == 0x370); - bool block_msg = is_lkas_msg || (is_acc_msg && gm_cam_long) || (addr == 0x184); + bool block_msg = is_lkas_msg || (is_acc_msg && gm_cam_long); + + // Block camera 0x370 when using pedal longitudinal (dashboard control) + // This is separate from gm_cam_long to avoid blocking 0x315/0x2CB + if (gm_pedal_long && (addr == 0x370)) { + block_msg = true; + } + if (!block_msg) { bus_fwd = 0; } @@ -333,6 +359,9 @@ static safety_config gm_init(uint16_t param) { ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CC_LONG_TX_MSGS); } else if (gm_cam_long) { ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_LONG_TX_MSGS); + } else if (gm_pedal_long) { + // Pedal long needs 0x370 for dashboard control + ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_LONG_TX_MSGS); } else { ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_TX_MSGS); } diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index f7b8d4641b..732385f890 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -381,6 +381,11 @@ class CarController(CarControllerBase): can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.POWERTRAIN, (CS.buttons_counter + 1) % 4, CruiseButtons.DECEL_SET)) if self.CP.enableGasInterceptor: can_sends.append(create_gas_interceptor_command(self.packer_pt, interceptor_gas_cmd, idx)) + # Dashboard display for PEDAL_LONG (matches BOLT_EUV behavior) + if self.CP.flags & GMFlags.PEDAL_LONG.value: + send_fcw = hud_alert == VisualAlert.fcw + can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, + hud_v_cruise * CV.MS_TO_KPH, hud_control, send_fcw)) if self.CP.carFingerprint not in CC_ONLY_CAR: friction_brake_bus = CanBus.CHASSIS # GM Camera exceptions