From e9e6e332cef88fb5f530642219dbf75d9b2a55dd Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 11 Dec 2024 18:06:56 -0500 Subject: [PATCH 1/2] Hyundai CAN: new gear shifter signal for `EV, HEV, PHEV` (#1530) Hyundai CAN: Explicitly parse gear shifter values for `EV, HEV, PHEV` --- opendbc/car/hyundai/carstate.py | 4 +++- opendbc/dbc/hyundai_kia_generic.dbc | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 556eb427da..83f6e1e9a2 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -34,11 +34,13 @@ def __init__(self, CP): "GEAR_SHIFTER" if CP.flags & HyundaiFlags.CANFD: self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"] + elif CP.flags & (HyundaiFlags.HYBRID | HyundaiFlags.EV): + self.shifter_values = can_define.dv["ELECT_GEAR"]["Elect_Gear_Shifter"] elif self.CP.flags & HyundaiFlags.CLUSTER_GEARS: self.shifter_values = can_define.dv["CLU15"]["CF_Clu_Gear"] elif self.CP.flags & HyundaiFlags.TCU_GEARS: self.shifter_values = can_define.dv["TCU12"]["CUR_GR"] - else: # preferred and elect gear methods use same definition + else: self.shifter_values = can_define.dv["LVR12"]["CF_Lvr_Gear"] self.accelerator_msg_canfd = "ACCELERATOR" if CP.flags & HyundaiFlags.EV else \ diff --git a/opendbc/dbc/hyundai_kia_generic.dbc b/opendbc/dbc/hyundai_kia_generic.dbc index c828d33c2f..0ad95f10e1 100644 --- a/opendbc/dbc/hyundai_kia_generic.dbc +++ b/opendbc/dbc/hyundai_kia_generic.dbc @@ -112,7 +112,7 @@ BO_ 1265 CLU11: 4 CLU BO_ 1260 Sign_Detection: 8 XXX SG_ SpeedLim_Nav_Cam : 40|8@1+ (1,0) [0|255] "km/h / mph" XXX SG_ SpeedLim_Nav_Cam2 : 48|8@1+ (1,0) [0|255] "km/h / mph" XXX - + BO_ 1492 TMU_GW_PE_01: 8 CLU SG_ TMU_IVRActivity : 0|2@1+ (1.0,0.0) [0.0|3.0] "" DATC SG_ TMU_PhoneActivity : 2|2@1+ (1.0,0.0) [0.0|3.0] "" DATC @@ -1661,7 +1661,7 @@ VAL_ 274 CUR_GR 1 "D" 2 "D" 3 "D" 4 "D" 5 "D" 6 "D" 7 "D" 8 "D" 14 "R" 0 "P"; VAL_ 512 HYDROGEN_GEAR_SHIFTER 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; VAL_ 871 CF_Lvr_IsgState 0 "enabled" 1 "activated" 2 "unknown" 3 "disabled"; VAL_ 871 CF_Lvr_Gear 12 "T" 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; -VAL_ 882 Elect_Gear_Shifter 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; +VAL_ 882 Elect_Gear_Shifter 4 "S" 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; VAL_ 905 ACCMode 0 "off" 1 "enabled" 2 "driver_override" 3 "off_maybe_fault" 4 "cancelled"; VAL_ 909 CF_VSM_Warn 2 "FCW" 3 "AEB"; VAL_ 916 ACCEnable 0 "SCC ready" 1 "SCC temp fault" 2 "SCC permanent fault" 3 "SCC permanent fault, communication issue"; From be9a8f6233e5b6dfb1a1248ea10bbc43fed938f3 Mon Sep 17 00:00:00 2001 From: Jason Young <46612682+jyoung8607@users.noreply.github.com> Date: Wed, 11 Dec 2024 21:26:30 -0500 Subject: [PATCH 2/2] GM: CAN parser cleanup, prep for Yukon (#1571) GM: Refactor and prep for Yukon --- opendbc/car/gm/carstate.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/opendbc/car/gm/carstate.py b/opendbc/car/gm/carstate.py index 42cb1c145e..9d03fd39c8 100644 --- a/opendbc/car/gm/carstate.py +++ b/opendbc/car/gm/carstate.py @@ -166,24 +166,22 @@ def get_can_parsers(CP): ("ECMAcceleratorPos", 80), ] + if CP.transmissionType == TransmissionType.direct: + pt_messages.append(("EBCMRegenPaddle", 50)) + if CP.enableBsm: pt_messages.append(("BCMBlindSpotMonitor", 10)) - # Used to read back last counter sent to PT by camera + cam_messages = [] if CP.networkLocation == NetworkLocation.fwdCamera: pt_messages += [ ("ASCMLKASteeringCmd", 0), ] - - if CP.transmissionType == TransmissionType.direct: - pt_messages.append(("EBCMRegenPaddle", 50)) - - cam_messages = [] - if CP.networkLocation == NetworkLocation.fwdCamera: cam_messages += [ ("ASCMLKASteeringCmd", 10), ("ASCMActiveCruiseControlStatus", 25), ] + if CP.carFingerprint not in SDGM_CAR: cam_messages += [ ("AEBCmd", 10),