From 9c726d99debd2de44f99deafa4efadc20bfa7056 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Fri, 19 Jun 2026 23:38:09 -0500 Subject: [PATCH] Revert "THE SMOKING GUN" This reverts commit 25a50a2ec384c7a1fbf9f7d65eae4c33865ad9f3. --- opendbc_repo/opendbc/car/gm/carcontroller.py | 4 +- opendbc_repo/opendbc/car/gm/gmcan.py | 43 ++++++++++--------- .../opendbc/car/gm/tests/test_gmcan.py | 6 +-- .../dbc/gm_global_a_powertrain_volt.dbc | 11 +++++ 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/opendbc_repo/opendbc/car/gm/carcontroller.py b/opendbc_repo/opendbc/car/gm/carcontroller.py index 66d2143fa..d3119e518 100644 --- a/opendbc_repo/opendbc/car/gm/carcontroller.py +++ b/opendbc_repo/opendbc/car/gm/carcontroller.py @@ -912,9 +912,7 @@ class CarController(CarControllerBase): # GasRegenCmdActive needs to be 1 to avoid cruise faults. It describes the ACC state, not actuation can_sends.append(gmcan.create_gas_regen_command( self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, acc_engaged, at_full_stop, - include_always_one3=self.CP.carFingerprint in kaofui_cars, - use_volt_layout=self.is_volt and self.CP.carFingerprint != CAR.CHEVROLET_VOLT_2019, - use_generated_layout=self.CP.carFingerprint == CAR.CHEVROLET_VOLT_2019)) + include_always_one3=self.CP.carFingerprint in kaofui_cars, use_volt_layout=self.is_volt)) can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, friction_brake_bus, self.apply_brake, idx, CC.enabled, near_stop, at_full_stop, self.CP, allow_near_stop_mode=volt_one_pedal_braking)) diff --git a/opendbc_repo/opendbc/car/gm/gmcan.py b/opendbc_repo/opendbc/car/gm/gmcan.py index 68fc9371e..3e8a511ca 100644 --- a/opendbc_repo/opendbc/car/gm/gmcan.py +++ b/opendbc_repo/opendbc/car/gm/gmcan.py @@ -360,27 +360,28 @@ def create_prndl2_command(packer, bus, press_regen_paddle, CP): prndl2_value = 5 if press_regen_paddle else 6 else: prndl2_value = 7 if press_regen_paddle else 6 - dat = bytes([ - 0x0C, - 0x0C, - 0x00, - prndl2_value, - 0x00, - 0x02 if press_regen_paddle else 0x00, - 0x01, - 0x00, - ]) - return CanData(0x1F5, dat, bus) + manual_mode = 1 if press_regen_paddle else 0 + values = { + "Byte0": 0x0C, + "Byte1": 0x0C, + "Byte2": 0x00, + "PRNDL2": prndl2_value, + "Byte4": 0x00, + "ManualMode": manual_mode, + "TransmissionState": 1, + "Byte7": 0x00, + } + return packer.make_can_msg("ECMPRDNL2", bus, values) def create_regen_paddle_command(packer, bus, press_regen_paddle): - dat = bytes([ - 0x20 if press_regen_paddle else 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - ]) - return CanData(0xBD, dat, bus) + values = { + "RegenPaddle": 2 if press_regen_paddle else 0, + "Byte1": 0, + "Byte2": 0, + "Byte3": 0, + "Byte4": 0, + "Byte5": 0, + "Byte6": 0, + } + return packer.make_can_msg("EBCMRegenPaddle", bus, values) diff --git a/opendbc_repo/opendbc/car/gm/tests/test_gmcan.py b/opendbc_repo/opendbc/car/gm/tests/test_gmcan.py index d8ff45b6f..e069ae9ed 100644 --- a/opendbc_repo/opendbc/car/gm/tests/test_gmcan.py +++ b/opendbc_repo/opendbc/car/gm/tests/test_gmcan.py @@ -62,13 +62,13 @@ class TestGMCan: assert dat.hex() == "20000000000000" - def test_gas_regen_command_matches_generated_volt_2019_layout(self): + def test_gas_regen_command_matches_starpilot_volt_2019(self): packer = CANPacker(DBC[CAR.CHEVROLET_VOLT_2019]["pt"]) - addr, dat, bus = gmcan.create_gas_regen_command(packer, 0, 5000, 1, True, False, include_always_one3=True, use_generated_layout=True) + addr, dat, bus = gmcan.create_gas_regen_command(packer, 0, 5000, 1, True, False, include_always_one3=True, use_volt_layout=True) assert addr == 0x2CB assert bus == 0 - assert dat.hex() == "41435c7000bca38f" + assert dat.hex() == "41429c4000bd63bf" def test_gas_regen_command_matches_starpilot_volt_ascm(self): packer = CANPacker(DBC[CAR.CHEVROLET_VOLT_ASCM]["pt"]) diff --git a/opendbc_repo/opendbc/dbc/gm_global_a_powertrain_volt.dbc b/opendbc_repo/opendbc/dbc/gm_global_a_powertrain_volt.dbc index 9361c7569..35610a022 100644 --- a/opendbc_repo/opendbc/dbc/gm_global_a_powertrain_volt.dbc +++ b/opendbc_repo/opendbc/dbc/gm_global_a_powertrain_volt.dbc @@ -82,6 +82,12 @@ VAL_TABLE_ HandsOffSWDetectionMode 2 "Failed" 1 "Enabled" 0 "Disabled" ; BO_ 189 EBCMRegenPaddle: 7 K17_EBCM SG_ RegenPaddle : 7|4@0+ (1,0) [0|0] "" NEO + SG_ Byte1 : 15|8@0+ (1,0) [0|255] "" NEO + SG_ Byte2 : 23|8@0+ (1,0) [0|255] "" NEO + SG_ Byte3 : 31|8@0+ (1,0) [0|255] "" NEO + SG_ Byte4 : 39|8@0+ (1,0) [0|255] "" NEO + SG_ Byte5 : 47|8@0+ (1,0) [0|255] "" NEO + SG_ Byte6 : 55|8@0+ (1,0) [0|255] "" NEO BO_ 190 ECMAcceleratorPos: 6 K20_ECM SG_ BrakePedalPos : 15|8@0+ (1,0) [0|0] "sticky" NEO @@ -192,9 +198,14 @@ BO_ 500 SportMode: 6 XXX SG_ SportMode : 15|1@0+ (1,0) [0|1] "" XXX BO_ 501 ECMPRDNL2: 8 K20_ECM + SG_ Byte0 : 7|8@0+ (1,0) [0|255] "" NEO + SG_ Byte1 : 15|8@0+ (1,0) [0|255] "" NEO + SG_ Byte2 : 23|8@0+ (1,0) [0|255] "" NEO SG_ TransmissionState : 48|4@1+ (1,0) [0|7] "" NEO SG_ PRNDL2 : 27|4@0+ (1,0) [0|255] "" NEO + SG_ Byte4 : 39|8@0+ (1,0) [0|255] "" NEO SG_ ManualMode : 41|1@0+ (1,0) [0|1] "" NEO + SG_ Byte7 : 63|8@0+ (1,0) [0|255] "" NEO BO_ 532 BRAKE_RELATED: 6 XXX SG_ UserBrakePressure : 0|9@0+ (1,0) [0|511] "" XXX