From 44b86d71d708f1a4a6315493c840adfe156f59c3 Mon Sep 17 00:00:00 2001 From: Jason Young <46612682+jyoung8607@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:39:20 -0400 Subject: [PATCH] VW MQB: EV_Gearshift -> Motor_EV_01 (#1237) * DBC updates * update comment in CRC function * updates to carstate and interface * update shifter VAL lookup --- opendbc/can/common.cc | 2 +- opendbc/car/volkswagen/carstate.py | 4 ++-- opendbc/car/volkswagen/interface.py | 2 +- opendbc/car/volkswagen/values.py | 2 +- opendbc/dbc/vw_mqb_2010.dbc | 27 +++++++++++++++++++-------- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/opendbc/can/common.cc b/opendbc/can/common.cc index bb7b2ee56d..87083e9476 100644 --- a/opendbc/can/common.cc +++ b/opendbc/can/common.cc @@ -165,7 +165,7 @@ unsigned int volkswagen_mqb_checksum(uint32_t address, const Signal &sig, const case 0x12E: // ACC_07 Automatic Cruise Control crc ^= (uint8_t[]){0xF8, 0xE5, 0x97, 0xC9, 0xD6, 0x07, 0x47, 0x21, 0x66, 0xDD, 0xCF, 0x6F, 0xA1, 0x94, 0x74, 0x63}[counter]; break; - case 0x187: // EV_Gearshift "Gear" selection data for EVs with no gearbox + case 0x187: // Motor_EV_01 gearshift position for BEVs with no transmission crc ^= (uint8_t[]){0x7F, 0xED, 0x17, 0xC2, 0x7C, 0xEB, 0x44, 0x21, 0x01, 0xFA, 0xDB, 0x15, 0x4A, 0x6B, 0x23, 0x05}[counter]; break; case 0x30C: // ACC_02 Automatic Cruise Control diff --git a/opendbc/car/volkswagen/carstate.py b/opendbc/car/volkswagen/carstate.py index b98f4ae06c..b8b783e0df 100644 --- a/opendbc/car/volkswagen/carstate.py +++ b/opendbc/car/volkswagen/carstate.py @@ -79,7 +79,7 @@ def update(self, pt_cp, cam_cp, *_) -> structs.CarState: if self.CP.transmissionType == TransmissionType.automatic: ret.gearShifter = self.parse_gear_shifter(self.CCP.shifter_values.get(pt_cp.vl["Getriebe_11"]["GE_Fahrstufe"], None)) elif self.CP.transmissionType == TransmissionType.direct: - ret.gearShifter = self.parse_gear_shifter(self.CCP.shifter_values.get(pt_cp.vl["EV_Gearshift"]["GearPosition"], None)) + ret.gearShifter = self.parse_gear_shifter(self.CCP.shifter_values.get(pt_cp.vl["Motor_EV_01"]["MO_Waehlpos"], None)) elif self.CP.transmissionType == TransmissionType.manual: ret.clutchPressed = not pt_cp.vl["Motor_14"]["MO_Kuppl_schalter"] if bool(pt_cp.vl["Gateway_72"]["BCM1_Rueckfahrlicht_Schalter"]): @@ -292,7 +292,7 @@ def get_can_parser(CP): if CP.transmissionType == TransmissionType.automatic: messages.append(("Getriebe_11", 20)) # From J743 Auto transmission control module elif CP.transmissionType == TransmissionType.direct: - messages.append(("EV_Gearshift", 10)) # From J??? unknown EV control module + messages.append(("Motor_EV_01", 10)) # From J??? unknown EV control module if CP.networkLocation == NetworkLocation.fwdCamera: # Radars are here on CANBUS.pt diff --git a/opendbc/car/volkswagen/interface.py b/opendbc/car/volkswagen/interface.py index 2361062fa5..4e8c84dfca 100644 --- a/opendbc/car/volkswagen/interface.py +++ b/opendbc/car/volkswagen/interface.py @@ -40,7 +40,7 @@ def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, exp if 0xAD in fingerprint[0] or docs: # Getriebe_11 ret.transmissionType = TransmissionType.automatic - elif 0x187 in fingerprint[0]: # EV_Gearshift + elif 0x187 in fingerprint[0]: # Motor_EV_01 ret.transmissionType = TransmissionType.direct else: ret.transmissionType = TransmissionType.manual diff --git a/opendbc/car/volkswagen/values.py b/opendbc/car/volkswagen/values.py index 67bfdb3bd8..fa98efb814 100644 --- a/opendbc/car/volkswagen/values.py +++ b/opendbc/car/volkswagen/values.py @@ -81,7 +81,7 @@ def __init__(self, CP): if CP.transmissionType == TransmissionType.automatic: self.shifter_values = can_define.dv["Getriebe_11"]["GE_Fahrstufe"] elif CP.transmissionType == TransmissionType.direct: - self.shifter_values = can_define.dv["EV_Gearshift"]["GearPosition"] + self.shifter_values = can_define.dv["Motor_EV_01"]["MO_Waehlpos"] self.hca_status_values = can_define.dv["LH_EPS_03"]["EPS_HCA_Status"] self.BUTTONS = [ diff --git a/opendbc/dbc/vw_mqb_2010.dbc b/opendbc/dbc/vw_mqb_2010.dbc index 586f256634..8efbb86fd7 100644 --- a/opendbc/dbc/vw_mqb_2010.dbc +++ b/opendbc/dbc/vw_mqb_2010.dbc @@ -1435,11 +1435,22 @@ BO_ 1720 Kombi_03: 8 XXX SG_ KBI_Max_Tankinhalt : 40|8@1+ (0.5,0) [0.0|126.5] "" XXX SG_ KBI_Reifenumfang_Sekundaer : 48|12@1+ (1,0) [0|4095] "Unit_MilliMeter" XXX -BO_ 391 EV_Gearshift: 8 XXX - SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX - SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX - SG_ GearPosition : 16|4@1+ (1,0) [0|255] "" XXX - SG_ RegenBrakingMode : 12|2@1+ (1,0) [0|3] "" XXX +BO_ 391 Motor_EV_01: 8 Motor_MQB_BEV + SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX + SG_ EV_Rekuperationsstufe : 12|3@1+ (1.0,0.0) [0.0|7] "" XXX + SG_ HV_Bordnetz_aktiv : 15|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Waehlpos : 16|3@1+ (1.0,0.0) [0.0|7] "" XXX + SG_ MO_Fehler_NTKreis : 19|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Fehler_Notabschaltung_Klima : 20|2@1+ (1.0,0.0) [0.0|3] "" XXX + SG_ MO_KLE_FStatus : 22|2@1+ (1.0,0.0) [0.0|3] "" XXX + SG_ MO_WH_Texte : 24|3@1+ (1.0,0.0) [0.0|7] "" XXX + SG_ MO_Drehzahl_VM : 32|16@1+ (0.25,0) [0.00|16383.00] "Unit_MinutInver" XXX + SG_ HV_Bordnetz_Fehler : 48|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Tankbereitschaft_Status : 49|3@1+ (1.0,0.0) [0.0|7] "" XXX + SG_ MO_Tankklappensteuerung : 52|2@1+ (1.0,0.0) [0.0|3] "" XXX + SG_ MO_HVEM_Eskalation : 54|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_HVEM_MaxLeistung : 55|9@1+ (50,0) [0|25450] "Unit_Watt" XXX CM_ SG_ 134 LWI_Lenkradwinkel "Steering angle WITH variable ratio effect included"; CM_ SG_ 159 EPS_HCA_Status "Status of Heading Control Assist feature"; @@ -1485,7 +1496,7 @@ CM_ SG_ 780 Folgefahrt "Following another vehicle"; CM_ SG_ 780 SetAbstand "Set following distance"; CM_ SG_ 780 Abstand "Following distance"; CM_ SG_ 780 SetSpeed "ACC set speed"; -CM_ SG_ 391 GearPosition "Traditional PRND plus B-mode aggressive regen, B-mode mapped to Drive"; +CM_ SG_ 391 MO_Waehlpos "Traditional PRND plus B-mode aggressive regen, B-mode mapped to Drive"; CM_ SG_ 679 ACC_ADAPTIVE "TSK_06.TSK_Limiter_ausgewaehlt seems to take precedence"; CM_ SG_ 960 ZAS_Kl_15 "Indicates ignition on"; CM_ SG_ 1720 KBI_BCmE_aktiv "Anzeige BCmE aktiv (BCmE-Screen oder Einsparhinweis in der Anzeige)"; @@ -1623,8 +1634,8 @@ VAL_ 681 AWV_Status_Anzeige 0 "Init" 1 "verfuegbar" 2 "nicht_verfuegbar" ; VAL_ 681 AWV_Einstellung_System_FSG 0 "deaktiviert" 1 "aktiviert" ; VAL_ 681 AWV_Einstellung_Warnung_FSG 0 "Aus" 1 "Setting_2" 2 "Setting_3" 3 "Setting_4" 4 "Setting_5" 5 "Ein" ; VAL_ 681 AWV_Warnlevel 0 "keine_Gefaehrdung" 63 "max_Gefaehrdung" ; -VAL_ 391 GearPosition 2 "P" 3 "R" 4 "N" 5 "D" 6 "D" ; -VAL_ 391 RegenBrakingMode 0 "default" 1 "B1" 2 "B2" 3 "B3" ; +VAL_ 391 MO_Waehlpos 2 "P" 3 "R" 4 "N" 5 "D" 6 "D" ; +VAL_ 391 EV_Rekuperationsstufe 0 "default" 1 "B1" 2 "B2" 3 "B3" ; VAL_ 870 Fast_Send_Rate_Active 0 "1 Hz" 1 "50 Hz" ; VAL_ 1720 KBI_Variante_USA 0 "keine USA-Variante" 1 "USA-Variante" ; VAL_ 1720 KBI_Variante 0 "Zeiger Kombiinstrument" 1 "Volldisplay Kombiinstrument" ;