From 6640a403b74d1f951d1c04f7432f885a62df2afe Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sun, 29 Mar 2026 14:20:59 -0500 Subject: [PATCH] fix sdgm sascm --- opendbc_repo/opendbc/car/gm/gmcan.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/gmcan.py b/opendbc_repo/opendbc/car/gm/gmcan.py index 68d417a3..0a49bf96 100644 --- a/opendbc_repo/opendbc/car/gm/gmcan.py +++ b/opendbc_repo/opendbc/car/gm/gmcan.py @@ -116,7 +116,14 @@ def create_adas_keepalive(bus): def create_gas_regen_command(packer, bus, throttle, idx, enabled, at_full_stop, include_always_one3=False, use_volt_layout=False): - if use_volt_layout: + gas_regen_msg = packer.dbc.name_to_msg.get("ASCMGasRegenCmd") + has_legacy_volt_layout = gas_regen_msg is not None and { + "GasRegenCmdActiveInv", + "GasRegenAlwaysOne", + "GasRegenAlwaysOne2", + }.issubset(gas_regen_msg.sigs) + + if use_volt_layout and has_legacy_volt_layout: values = { "GasRegenCmdActive": enabled, "RollingCounter": idx, @@ -136,8 +143,8 @@ def create_gas_regen_command(packer, bus, throttle, idx, enabled, at_full_stop, return packer.make_can_msg("ASCMGasRegenCmd", bus, values) - # Use the legacy GM Global A camera-long GasRegen byte layout. - # The regenerated DBC shape does not expose the same wire-format helper fields. + # Preserve the legacy GM Global A GasRegen wire layout when the DBC no longer + # exposes the helper fields used by older ACC implementations. throttle = int(throttle) dat = bytearray(8) dat[0] = ((idx & 0x3) << 6) | int(enabled)