From d8aba58b253eaebe42c066f18251b19853d3efb0 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 1/3] 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 44ec0cd3e0..8993005560 100644 --- a/opendbc/dbc/vw_mqb_2010.dbc +++ b/opendbc/dbc/vw_mqb_2010.dbc @@ -1433,11 +1433,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"; @@ -1483,7 +1494,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)"; @@ -1621,8 +1632,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" ; From 4b31c18530ea6a957855b7bf0c981998dfe08c28 Mon Sep 17 00:00:00 2001 From: Jason Young <46612682+jyoung8607@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:00:50 -0400 Subject: [PATCH 2/3] VW MQB: Various message and signal updates (#1238) * VehicleSpeed -> ESP_08 * ESP_21 updates * Motor_20 updates * SWA_01 updates * ESP_20 updates * Getriebe_11 updates --- opendbc/dbc/vw_mqb_2010.dbc | 192 +++++++++++++++++++++++------------- 1 file changed, 121 insertions(+), 71 deletions(-) diff --git a/opendbc/dbc/vw_mqb_2010.dbc b/opendbc/dbc/vw_mqb_2010.dbc index 8993005560..ecf529c5fa 100644 --- a/opendbc/dbc/vw_mqb_2010.dbc +++ b/opendbc/dbc/vw_mqb_2010.dbc @@ -391,34 +391,60 @@ BO_ 178 ESP_19: 8 Gateway_MQB SG_ ESP_VR_Radgeschw_02 : 48|16@1+ (0.0075,0) [0|491.49] "Unit_KiloMeterPerHour" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB BO_ 1629 ESP_20: 8 Gateway_MQB - SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" Vector__XXX - SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" Vector__XXX - SG_ BR_Systemart : 12|2@1+ (1,0) [0|3] "" Vector__XXX - SG_ ESP_Zaehnezahl : 16|8@1+ (1,0) [0|255] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ ESP_Charisma_FahrPr : 24|4@1+ (1,0) [0|15] "" Vector__XXX - SG_ ESP_Charisma_Status : 28|2@1+ (1,0) [0|3] "" Vector__XXX - SG_ BR_QBit_Reifenumfang : 51|1@1+ (1,0) [0|1] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ BR_Reifenumfang : 52|12@1+ (1,0) [0|4095] "Unit_MilliMeter" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB + SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX + SG_ BR_Systemart : 12|2@1+ (1,0) [0|3] "" XXX + SG_ ESP_SpannungsAnf_02 : 14|2@1+ (1,0) [0|3] "" XXX + SG_ ESP_Zaehnezahl : 16|8@1+ (1,0) [0|255] "" XXX + SG_ ESP_Charisma_FahrPr : 24|4@1+ (1,0) [0|15] "" XXX + SG_ ESP_Charisma_Status : 28|2@1+ (1,0) [0|3] "" XXX + SG_ ESP_Wiederstart_Anz_01 : 30|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Wiederstart_Anz_02 : 31|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Wiederstart_Anz_03 : 32|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Wiederstart_Anz_04 : 33|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_01 : 34|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_02 : 35|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_03 : 36|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_04 : 37|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_05 : 38|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_06 : 39|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_07 : 40|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Stoppverbot_Anz_Std : 41|1@1+ (1,0) [0|1] "" XXX + SG_ ESP_Dachrelingsensor : 42|2@1+ (1,0) [0|3] "" XXX + SG_ ESP_Stoppverbot_Anz_08 : 44|1@1+ (1,0) [0|1] "" XXX + SG_ HDC_Charisma_FahrPr : 45|4@1+ (1,0) [0|15] "" XXX + SG_ HDC_Charisma_Status : 49|2@1+ (1,0) [0|3] "" XXX + SG_ BR_QBit_Reifenumfang : 51|1@1+ (1,0) [0|1] "" XXX + SG_ BR_Reifenumfang : 52|12@1+ (1,0) [0|4095] "Unit_MilliMeter" XXX BO_ 253 ESP_21: 8 Gateway_MQB - SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,LEH_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" Airbag_MQB,BMS_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,LEH_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ BR_Eingriffsmoment : 12|10@1+ (1,-509) [-509|509] "Unit_NewtoMeter" Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_v_Signal : 32|16@1+ (0.01,0) [0|655.32] "Unit_KiloMeterPerHour" Airbag_MQB,BMS_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,LEH_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB,SAK_MQB - SG_ ASR_Tastung_passiv : 48|1@1+ (1,0) [0|1] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_Tastung_passiv : 49|1@1+ (1,0) [0|1] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_Systemstatus : 50|1@1+ (1,0) [0|1] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ASR_Schalteingriff : 51|2@1+ (1,0) [0|3] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ ESP_Haltebestaetigung : 53|1@1+ (1,0) [0|1] "" Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_QBit_v_Signal : 55|1@1+ (1,0) [0|1] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,LEH_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ABS_Bremsung : 56|1@1+ (1,0) [0|1] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ASR_Anf : 57|1@1+ (1,0) [0|1] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ MSR_Anf : 58|1@1+ (1,0) [0|1] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ EBV_Eingriff : 59|1@1+ (1,0) [0|1] "" Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ EDS_Eingriff : 60|1@1+ (1,0) [0|1] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_Eingriff : 61|1@1+ (1,0) [0|1] "" Airbag_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_ASP : 62|1@1+ (1,0) [0|1] "" Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ ESP_Anhaltevorgang_ACC_aktiv : 63|1@1+ (1,0) [0|1] "" Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB + SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX + SG_ BR_Eingriffsmoment : 12|10@1+ (1,-509) [-509|509] "" XXX + SG_ ESP_PLA_Bremseingriff : 22|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Diagnose : 23|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESC_Reku_Freigabe : 24|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESC_v_Signal_Qualifier_High_Low : 25|3@1+ (1.0,0.0) [0.0|7] "" XXX + SG_ ESP_Vorsteuerung : 28|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_AWV3_Brems_aktiv : 29|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ OBD_Schlechtweg : 30|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ OBD_QBit_Schlechtweg : 31|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_v_Signal : 32|16@1+ (0.01,0) [0.00|655.32] "Unit_KiloMeterPerHour" XXX + SG_ ASR_Tastung_passiv : 48|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Tastung_passiv : 49|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Systemstatus : 50|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ASR_Schalteingriff : 51|2@1+ (1.0,0.0) [0.0|3] "" XXX + SG_ ESP_Haltebestaetigung : 53|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_MKB_Abbruch_Geschw : 54|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_QBit_v_Signal : 55|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ABS_Bremsung : 56|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ASR_Anf : 57|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MSR_Anf : 58|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ EBV_Eingriff : 59|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ EDS_Eingriff : 60|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Eingriff : 61|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_ASP : 62|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Anhaltevorgang_ACC_aktiv : 63|1@1+ (1.0,0.0) [0.0|1] "" XXX BO_ 987 Gateway_72: 8 Gateway_MQB SG_ BCM_01_alt : 0|1@1+ (1,0) [0|1] "" Airbag_MQB @@ -482,18 +508,21 @@ BO_ 296 Getriebe_06: 3 Getriebe_DQ_Hybrid_MQB SG_ GE_Testparameter_2 : 16|8@1+ (1,0) [0|255] "" Waehlhebel_MQB BO_ 173 Getriebe_11: 8 Getriebe_DQ_Hybrid_MQB - SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ COUNTERXX : 8|4@1+ (1,0) [0|15] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_MMom_Soll_02 : 12|10@1+ (1,-509) [-509|509] "Unit_NewtoMeter" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_MMom_Vorhalt_02 : 22|10@1+ (1,-509) [-509|509] "Unit_NewtoMeter" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Uefkt : 32|10@1+ (0.1,0) [0|102.2] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Fahrstufe : 42|5@1+ (1,0) [0|31] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Schaltvorgang : 47|1@1+ (1,0) [0|1] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Status_Kupplung : 54|2@1+ (1,0) [0|3] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_MMom_Status : 56|2@1+ (1,0) [0|3] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Freig_MMom_Vorhalt : 58|1@1+ (1,0) [0|1] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Verbot_Ausblendung : 59|1@1+ (1,0) [0|1] "" Gateway_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Zielgang : 60|4@1+ (1,0) [0|15] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB + SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX + SG_ COUNTER_DISABLED : 8|4@1+ (1,0) [0|15] "" XXX + SG_ GE_MMom_Soll_02 : 12|10@1+ (1,-509) [-509|509] "" XXX + SG_ GE_MMom_Vorhalt_02 : 22|10@1+ (1,-509) [-509|509] "" XXX + SG_ GE_Uefkt : 32|10@1+ (0.1,0) [0|102.2] "" XXX + SG_ GE_Fahrstufe : 42|4@1+ (1,0) [0|15] "" XXX + SG_ GE_reserv_Fahrstufe : 46|1@1+ (1,0) [0|1] "" XXX + SG_ GE_Schaltablauf : 47|2@1+ (1,0) [0|3] "" XXX + SG_ GE_Uefkt_unplausibel : 49|1@1+ (1,0) [0|1] "" XXX + SG_ GE_MMom_Status_02 : 50|3@1+ (1,0) [0|7] "" XXX + SG_ GE_Status_Kraftschluss : 53|3@1+ (1,0) [0|7] "" XXX + SG_ GE_MMom_Status : 56|2@1+ (1,0) [0|3] "" XXX + SG_ GE_Freig_MMom_Vorhalt : 58|1@1+ (1,0) [0|1] "" XXX + SG_ GE_Verbot_Ausblendung : 59|1@1+ (1,0) [0|1] "" XXX + SG_ GE_Zielgang : 60|4@1+ (1,0) [0|15] "" XXX BO_ 174 Getriebe_12: 8 Getriebe_DQ_Hybrid_MQB SG_ Getriebe_12_CRC : 0|8@1+ (1,0) [0|255] "" Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB @@ -858,15 +887,19 @@ BO_ 1648 Motor_18: 8 Motor_Diesel_MQB BO_ 289 Motor_20: 8 Motor_Diesel_MQB SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX SG_ COUNTER : 8|4@1+ (1,0) [0|255] "" XXX - SG_ MO_Fahrpedalrohwert_01 : 12|8@1+ (0.4,0) [0|101.6] "Unit_PerCent" Airbag_MQB,Gateway_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ MO_QBit_Fahrpedalwerte_01 : 20|1@1+ (1,0) [0|1] "" Airbag_MQB,Gateway_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ MO_Fahrpedalgradient : 21|8@1+ (25,0) [0|6350] "Unit_PerCentPerSecon" Airbag_MQB,Gateway_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ MO_Sig_Fahrpedalgradient : 29|1@1+ (1,0) [0|1] "" Airbag_MQB,Gateway_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ MO_rel_Saugrohrdruck : 30|6@1+ (18,0) [0|1116] "Unit_MilliBar" Gateway_MQB - SG_ MO_rel_Saugrohrdruck_gem_err : 36|1@1+ (1,0) [0|1] "" Gateway_MQB - SG_ MO_Moment_im_Leerlauf : 37|1@1+ (1,0) [0|1] "" Gateway_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB - SG_ MO_Schubabschaltung : 38|1@1+ (1,0) [0|1] "" Gateway_MQB - SG_ MO_Solldrehz_Leerlauf : 40|8@1+ (10,0) [0|2540] "Unit_MinutInver" Gateway_MQB,Getriebe_DQ_Hybrid_MQB,Getriebe_DQ_MQB + SG_ MO_Fahrpedalrohwert_01 : 12|8@1+ (0.4,0) [0.0|101.6] "Unit_PerCent" XXX + SG_ MO_QBit_Fahrpedalwerte_01 : 20|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Fahrpedalgradient : 21|8@1+ (25,0) [0|6350] "Unit_PerCentPerSecon" XXX + SG_ MO_Sig_Fahrpedalgradient : 29|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_rel_Saugrohrdruck : 30|6@1+ (18,0) [0|1116] "Unit_MilliBar" XXX + SG_ MO_rel_Saugrohrdruck_gem_err : 36|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Moment_im_Leerlauf : 37|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Schubabschaltung : 38|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_StartStopp_StoppVorbereitung : 39|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ MO_Solldrehz_Leerlauf : 40|8@1+ (10,0) [0|2540] "Unit_MinutInver" XXX + SG_ MO_Entkopplung_Sollschlupf : 48|7@1+ (20,0) [0|2480] "Unit_MinutInver" XXX + SG_ MO_temporaere_Fahrerabwesenheit : 55|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ TSK_a_Soll_gradientenbegrenzt : 57|7@1+ (0.1,-7.2) [-7.2|5.4] "Unit_MeterPerSeconSquar" XXX BO_ 967 Motor_26: 8 Motor_Diesel_MQB SG_ MO_HYB_Status_HV_Ladung : 8|3@1+ (1,0) [0|7] "" Gateway_MQB @@ -1263,10 +1296,20 @@ BO_ 159 LH_EPS_03: 8 XXX SG_ EPS_VZ_Lenkmoment : 55|1@1+ (1,0) [0|1] "" XXX SG_ EPS_Lenkungstyp : 60|4@1+ (1,0) [0|15] "" XXX -BO_ 286 VehicleSpeed: 8 XXX - SG_ VehicleSpeed_CRC : 0|8@1+ (1,0) [0|255] "" XXX - SG_ VehicleSpeed_BZ : 8|4@1+ (1,0) [0|15] "" XXX - SG_ Speed : 52|12@1+ (0.125,0) [0|1] "" XXX +BO_ 286 ESP_08: 8 Gateway_MQB + SG_ ESP_08_CRC : 0|8@1+ (1,0) [0|255] "" XXX + SG_ ESP_08_BZ : 8|4@1+ (1,0) [0|15] "" XXX + SG_ ESP_ANB_CM_Rueckk_Umsetz : 12|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Konsistenz_ACC_Botschaft : 13|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Stillstandsphase_erschoepft : 14|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_ZT_Rueckk_Umsetz : 15|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Tuerkontakt_Fahrertuer : 16|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Abrutschen_Stillstand : 18|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_Fahrer_tritt_ZBR_Schw : 19|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_QBit_v_ref : 41|1@1+ (1.0,0.0) [0.0|1] "" XXX + SG_ ESP_v_ref_Fahrtrichtung : 42|2@1+ (1.0,0.0) [0.0|3] "" XXX + SG_ ESC_Bremsdruckgradient : 44|8@1+ (10,0) [0|2500] "Unit_BarPerSecon" XXX + SG_ ESP_v_ref : 52|12@1+ (0.125,0) [0.000|511.500] "Unit_KiloMeterPerHour" XXX BO_ 919 LDW_02: 8 XXX SG_ LDW_Gong : 12|2@1+ (1,0) [0|3] "" XXX @@ -1332,25 +1375,32 @@ BO_ 695 RCTA_01: 8 XXX SG_ RCTA_01_CRC : 0|8@1+ (1,0) [0|255] "" XXX BO_ 783 SWA_01: 8 Gateway_MQB - SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" Vector__XXX - SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" Vector__XXX - SG_ SWA_Anzeigen : 12|4@1+ (1,0) [0|15] "" Kombi_D4 - SG_ SWA_Blindheit_erkannt : 16|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_rel_Nichtverf : 17|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_rel_Fehler : 18|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Sta_aktiv : 19|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Sta_passiv : 20|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Standziele_li : 24|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Kolonne_li : 25|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Infostufe_SWA_li : 26|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Warnung_SWA_li : 27|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Kolonne_mi : 33|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Standziele_re : 40|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Kolonne_re : 41|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Infostufe_SWA_re : 42|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Warnung_SWA_re : 43|1@1+ (1,0) [0|1] "" Vector__XXX - SG_ SWA_Gischtzaehler : 48|7@1+ (1,0) [0|100] "Unit_PerCent" Vector__XXX - SG_ SWA_KD_Fehler : 59|1@1+ (1,0) [0|1] "" Vector__XXX + SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX + SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX + SG_ SWA_Anzeigen : 12|4@1+ (1,0) [0|15] "" XXX + SG_ SWA_Blindheit_erkannt : 16|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_rel_Nichtverf : 17|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_rel_Fehler : 18|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Sta_aktiv : 19|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Sta_passiv : 20|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_FT_RueckLED : 21|1@1+ (1,0) [0|1] "" XXX + SG_ ASW_Status : 22|2@1+ (1,0) [0|3] "" XXX + SG_ SWA_Standziele_li : 24|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Kolonne_li : 25|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Infostufe_SWA_li : 26|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Warnung_SWA_li : 27|1@1+ (1,0) [0|1] "" XXX + SG_ ASW_Warnung_FS : 28|1@1+ (1,0) [0|1] "" XXX + SG_ ASW_Warnung_BFS : 29|1@1+ (1,0) [0|1] "" XXX + SG_ ASW_Kombitexte : 30|3@1+ (1,0) [0|7] "" XXX + SG_ SWA_Kolonne_mi : 33|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Standziele_re : 40|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Kolonne_re : 41|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Infostufe_SWA_re : 42|1@1+ (1,0) [0|1] "" XXX + SG_ SWA_Warnung_SWA_re : 43|1@1+ (1,0) [0|1] "" XXX + SG_ HRE_Anzeigetexte : 44|4@1+ (1,0) [0|15] "" XXX + SG_ SWA_Gischtzaehler : 48|7@1+ (1,0) [0|100] "Unit_PerCent" XXX + SG_ Heckradar_Kombitexte : 56|5@1+ (1,0) [0|31] "" XXX + SG_ RCTA_Kombitexte : 61|3@1+ (1,0) [0|7] "" XXX BO_ 804 ACC_04: 8 XXX SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" XXX @@ -1456,7 +1506,7 @@ CM_ SG_ 159 EPS_Lenkmoment "Steering input by driver, torque"; CM_ SG_ 159 EPS_VZ_Lenkmoment "Steering input by driver, direction"; CM_ SG_ 159 EPS_Berechneter_LW "Raw steering angle, degrees"; CM_ SG_ 159 EPS_VZ_BLW "Raw steering angle, direction"; -CM_ SG_ 173 COUNTERXX "Message not renamed to COUNTER because J533 rate-limiting makes it look like messages are being lost"; +CM_ SG_ 173 COUNTER_DISABLED "Message not renamed to COUNTER because J533 rate-limiting makes it look like messages are being lost"; CM_ SG_ 294 HCA_01_Vib_Freq "Frequenz der Lenkradvibration"; CM_ SG_ 294 HCA_01_LM_Offset "Von HCA angefordertes Lenkmoment (Betrag)"; CM_ SG_ 294 EA_ACC_Sollstatus "Status-Anforderung ACC von Emergency Alert. Statuswechsel bei Flanke. Solange Wert=1, wird EA_ACC_Wunschgeschwindigkeit übernommen. Wert=2 führt zu Zustand ¿ACC_GRA_passiv¿"; From 751404a8b50bbcd54e539bace257c7480a9463ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Czeka=C5=84ski?= Date: Thu, 12 Sep 2024 21:02:08 +0200 Subject: [PATCH 3/3] VW MQB: Added unittests for CRC calculation (#1235) * VW MQB: Added unittests for CRC calculation Some of the messages are either missing fields that causes serialization to skip bits or CRC/BZ fields aren't picked up by packers leading to invalid values. * VW MQB: Add missing fields in Getriebe_11 Test case is reenabled and now passes * EV_Gearshift -> Motor_EV_01, enable test * skip Getribe_11 testing with a note about why * reenable all others, except SWA_01 * turns out we can still test Getriebe_11 * New test data for SWA_01, re-enable test * no longer a need for test skipping * no longer a need for custom tests * more concise * prefix with VW for clarity --------- Co-authored-by: Jason Young --- opendbc/can/tests/test_checksums.py | 383 ++++++++++++++++++++++++++++ 1 file changed, 383 insertions(+) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index e584ba30a5..52ac79398b 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -1,3 +1,4 @@ +import copy from opendbc.can.parser import CANParser from opendbc.can.packer import CANPacker @@ -31,3 +32,385 @@ def test_honda_checksum(self): assert parser.vl['LKAS_HUD']['CHECKSUM'] == std assert parser.vl['LKAS_HUD_A']['CHECKSUM'] == ext + + def verify_vw_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: list[int], crc_field: str = 'CHECKSUM', counter_field: str = 'COUNTER'): + """Validates AUTOSAR E2E Profile 2 CRC calculation against recorded reference messages""" + dbc_file = "vw_mqb_2010" + parser = CANParser(dbc_file, [(msg_name, 0)], 0) + packer = CANPacker(dbc_file) + + assert len(test_messages) == 16 # All counter values must be tested + + for data in test_messages: + expected_msg = (msg_addr, data, 0) + parser.update_strings([0, [expected_msg]]) + expected = copy.deepcopy(parser.vl[msg_name]) + + modified = copy.deepcopy(expected) + modified.pop(crc_field, None) + modified_msg = packer.make_can_msg(msg_name, 0, modified) + + parser.update_strings([0, [modified_msg]]) + tested = parser.vl[msg_name] + with subtests.test(counter=expected[counter_field]): + assert tested[crc_field] == expected[crc_field] + + def test_vw_mqb_crc_LWI_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "LWI_01", 0x86, [ + b'\x6b\x00\xbd\x00\x00\x00\x00\x00', + b'\xee\x01\x0a\x00\x00\x00\x00\x00', + b'\xd8\x02\xa9\x00\x00\x00\x00\x00', + b'\x03\x03\xbe\xa2\x12\x00\x00\x00', + b'\x7b\x04\x31\x20\x03\x00\x00\x00', + b'\x8b\x05\xe2\x85\x09\x00\x00\x00', + b'\x63\x06\x13\x21\x00\x00\x00\x00', + b'\x66\x07\x05\x00\x00\x00\x00\x00', + b'\x49\x08\x0d\x00\x00\x00\x00\x00', + b'\x5f\x09\x7e\x60\x01\x00\x00\x00', + b'\xaf\x0a\x72\x20\x00\x00\x00\x00', + b'\x59\x0b\x1b\x00\x00\x00\x00\x00', + b'\xa8\x0c\x06\x00\x00\x00\x00\x00', + b'\xbc\x0d\x72\x20\x00\x00\x00\x00', + b'\xf9\x0e\x0f\x00\x00\x00\x00\x00', + b'\x60\x0f\x62\xc0\x00\x00\x00\x00', + ]) + + def test_vw_mqb_crc_ACC_02(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_02", 780, [ + b'\x82\xf0\x3f\x00\x40\x30\x00\x40', + b'\xe6\xf1\x3f\x00\x40\x30\x00\x40', + b'\x4a\xf2\x3f\x00\x40\x30\x00\x40', + b'\x2e\xf3\x3f\x00\x40\x30\x00\x40', + b'\x3d\xf4\x3f\x00\x40\x30\x00\x40', + b'\x59\xf5\x3f\x00\x40\x30\x00\x40', + b'\xf5\xf6\x3f\x00\x40\x30\x00\x40', + b'\x91\xf7\x3f\x00\x40\x30\x00\x40', + b'\xd3\xf8\x3f\x00\x40\x30\x00\x40', + b'\xb7\xf9\x3f\x00\x40\x30\x00\x40', + b'\x1b\xfa\x3f\x00\x40\x30\x00\x40', + b'\x7f\xfb\x3f\x00\x40\x30\x00\x40', + b'\x6c\xfc\x3f\x00\x40\x30\x00\x40', + b'\x08\xfd\x3f\x00\x40\x30\x00\x40', + b'\xa4\xfe\x3f\x00\x40\x30\x00\x40', + b'\xc0\xff\x3f\x00\x40\x30\x00\x40', + ]) + + def test_vw_mqb_crc_LH_EPS_03(self, subtests): + self.verify_vw_mqb_crc(subtests, "LH_EPS_03", 0x9F, [ + b'\x11\x30\x2e\x00\x05\x1c\x80\x30', + b'\x5b\x31\x8e\x03\x05\x53\x00\x30', + b'\xcb\x32\xd3\x06\x05\x73\x00\x30', + b'\xf2\x33\x28\x00\x05\x26\x00\x30', + b'\x0b\x34\x44\x00\x05\x5b\x80\x30', + b'\xed\x35\x80\x00\x03\x34\x00\x30', + b'\xf0\x36\x88\x00\x05\x3d\x80\x30', + b'\x9e\x37\x44\x03\x05\x41\x00\x30', + b'\x68\x38\x06\x01\x05\x18\x80\x30', + b'\x87\x39\x51\x00\x05\x11\x80\x30', + b'\x8c\x3a\x29\x00\x05\xac\x00\x30', + b'\x08\x3b\xbd\x00\x05\x8e\x00\x30', + b'\xd4\x3c\x19\x00\x05\x05\x80\x30', + b'\x29\x3d\x54\x00\x05\x5b\x00\x30', + b'\xa1\x3e\x49\x01\x03\x04\x80\x30', + b'\xe2\x3f\x05\x00\x05\x0a\x00\x30', + ]) + + def test_vw_mqb_crc_Getriebe_11(self, subtests): + self.verify_vw_mqb_crc(subtests, "Getriebe_11", 0xAD, [ + b'\xf8\xe0\xbf\xff\x5f\x20\x20\x20', + b'\xb0\xe1\xbf\xff\xc6\x98\x21\x80', + b'\xd2\xe2\xbf\xff\x5f\x20\x20\x20', + b'\x00\xe3\xbf\xff\xaa\x20\x20\x10', + b'\xf1\xe4\xbf\xff\x5f\x20\x20\x20', + b'\xc4\xe5\xbf\xff\x5f\x20\x20\x20', + b'\xda\xe6\xbf\xff\x5f\x20\x20\x20', + b'\x85\xe7\xbf\xff\x5f\x20\x20\x20', + b'\x12\xe8\xbf\xff\x5f\x20\x20\x20', + b'\x45\xe9\xbf\xff\xaa\x20\x20\x10', + b'\x03\xea\xbf\xff\xcc\x20\x20\x10', + b'\xfc\xeb\xbf\xff\x5f\x20\x21\x20', + b'\xfe\xec\xbf\xff\xad\x20\x20\x10', + b'\xbd\xed\xbf\xff\xaa\x20\x20\x10', + b'\x67\xee\xbf\xff\xaa\x20\x20\x10', + b'\x36\xef\xbf\xff\xaa\x20\x20\x10', + ], counter_field="COUNTER_DISABLED") # see opendbc#1235 + + def test_vw_mqb_crc_ESP_21(self, subtests): + self.verify_vw_mqb_crc(subtests, "ESP_21", 0xFD, [ + b'\x66\xd0\x1f\x80\x45\x05\x00\x00', + b'\x87\xd1\x1f\x80\x52\x05\x00\x00', + b'\xcd\xd2\x1f\x80\x50\x06\x00\x00', + b'\xfd\xd3\x1f\x80\x35\x02\x00\x00', + b'\xfa\xd4\x1f\x80\x22\x05\x00\x00', + b'\xfd\xd5\x1f\x80\x84\x04\x00\x00', + b'\x2e\xd6\x1f\x80\xf0\x03\x00\x00', + b'\x9f\xd7\x1f\x80\x00\x00\x00\x00', + b'\x1e\xd8\x1f\x80\xb3\x03\x00\x00', + b'\x61\xd9\x1f\x80\x6d\x05\x00\x00', + b'\x44\xda\x1f\x80\x47\x02\x00\x00', + b'\x86\xdb\x1f\x80\x3a\x02\x00\x00', + b'\x39\xdc\x1f\x80\xcb\x01\x00\x00', + b'\x19\xdd\x1f\x80\x00\x00\x00\x00', + b'\x8c\xde\x1f\x80\xba\x04\x00\x00', + b'\xfb\xdf\x1f\x80\x46\x00\x00\x00', + ]) + + def test_vw_mqb_crc_ESP_05(self, subtests): + self.verify_vw_mqb_crc(subtests, "ESP_05", 0x106, [ + b'\x90\x80\x64\x00\x00\x00\xe7\x10', + b'\xf4\x81\x64\x00\x00\x00\xe7\x10', + b'\x90\x82\x63\x00\x00\x00\xe8\x10', + b'\xa0\x83\x63\x00\x00\x00\xe6\x10', + b'\xe7\x84\x63\x00\x00\x00\xe8\x10', + b'\x2e\x85\x78\x04\x00\x00\xea\x30', + b'\x7b\x86\x63\x00\x00\x00\xe6\x10', + b'\x71\x87\x79\x04\x00\x00\xd0\x30', + b'\x50\x88\x79\x04\x00\x00\xea\x30', + b'\x81\x89\x64\x00\x00\x00\xe1\x10', + b'\x6a\x8a\x68\x00\x00\x04\xd0\x10', + b'\x17\x8b\x6a\x04\x00\x00\xe6\x10', + b'\xc7\x8c\x63\x00\x00\x00\xd1\x10', + b'\x53\x8d\x64\x04\x00\x00\xe2\x10', + b'\x24\x8e\x63\x00\x00\x00\xe7\x10', + b'\x3f\x8f\x82\x04\x00\x00\xe6\x30', + ]) + + def test_vw_mqb_crc_ACC_10(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_10", 0x117, [ + b'\x9b\x00\x00\x40\x68\x00\x00\xff', + b'\xff\x01\x00\x40\x68\x00\x00\xff', + b'\x53\x02\x00\x40\x68\x00\x00\xff', + b'\x37\x03\x00\x40\x68\x00\x00\xff', + b'\x24\x04\x00\x40\x68\x00\x00\xff', + b'\x40\x05\x00\x40\x68\x00\x00\xff', + b'\xec\x06\x00\x40\x68\x00\x00\xff', + b'\x88\x07\x00\x40\x68\x00\x00\xff', + b'\xca\x08\x00\x40\x68\x00\x00\xff', + b'\xae\x09\x00\x40\x68\x00\x00\xff', + b'\x02\x0a\x00\x40\x68\x00\x00\xff', + b'\x66\x0b\x00\x40\x68\x00\x00\xff', + b'\x75\x0c\x00\x40\x68\x00\x00\xff', + b'\x11\x0d\x00\x40\x68\x00\x00\xff', + b'\xbd\x0e\x00\x40\x68\x00\x00\xff', + b'\xd9\x0f\x00\x40\x68\x00\x00\xff', + ]) + + def test_vw_mqb_crc_TSK_06(self, subtests): + self.verify_vw_mqb_crc(subtests, "TSK_06", 0x120, [ + b'\xc1\x00\x00\x02\x00\x08\xff\x21', + b'\x34\x01\x00\x02\x00\x08\xff\x21', + b'\xcc\x02\x00\x02\x00\x08\xff\x21', + b'\x1e\x03\x00\x02\x00\x08\xff\x21', + b'\x48\x04\x00\x02\x00\x08\xff\x21', + b'\x4a\x05\x00\x02\x00\x08\xff\x21', + b'\xa5\x06\x00\x02\x00\x08\xff\x21', + b'\xa7\x07\x00\x02\x00\x08\xff\x21', + b'\xfe\x08\x00\x02\x00\x08\xff\x21', + b'\xa8\x09\x00\x02\x00\x08\xff\x21', + b'\x73\x0a\x00\x02\x00\x08\xff\x21', + b'\xdf\x0b\x00\x02\x00\x08\xff\x21', + b'\x05\x0c\x00\x02\x00\x08\xff\x21', + b'\xb5\x0d\x00\x02\x00\x08\xff\x21', + b'\xde\x0e\x00\x02\x00\x08\xff\x21', + b'\x0b\x0f\x00\x02\x00\x08\xff\x21', + ]) + + def test_vw_mqb_crc_Motor_20(self, subtests): + self.verify_vw_mqb_crc(subtests, "Motor_20", 0x121, [ + b'\xb9\x00\x00\xc0\x39\x46\x7e\xfe', + b'\x85\x31\x20\x00\x1a\x46\x7e\xfe', + b'\xc7\x12\x00\x40\x1a\x46\x7e\xfe', + b'\x53\x93\x00\x00\x19\x46\x7e\xfe', + b'\xa4\x34\x00\x80\x1a\x46\x7e\xfe', + b'\x0e\x55\x20\x60\x18\x46\x7e\xfe', + b'\x3f\x06\x00\xc0\x37\x4c\x7e\xfe', + b'\x0c\x07\x00\x40\x39\x46\x7e\xfe', + b'\x2a\x08\x00\x00\x3a\x46\x7e\xfe', + b'\x7f\x49\x20\x80\x1a\x46\x7e\xfe', + b'\x2f\x0a\x00\xc0\x39\x46\x7e\xfe', + b'\x70\xbb\x00\x00\x17\x46\x7e\xfe', + b'\x06\x0c\x00\x00\x39\x46\x7e\xfe', + b'\x4b\x9d\x20\xe0\x16\x4c\x7e\xfe', + b'\x73\xfe\x00\x40\x16\x46\x7e\xfe', + b'\xaf\x0f\x20\x80\x39\x4c\x7e\xfe', + ]) + + def test_vw_mqb_crc_ACC_06(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_06", 0x122, [ + b'\x14\x80\x00\xfe\x07\x00\x00\x18', + b'\x9f\x81\x00\xfe\x07\x00\x00\x18', + b'\x0a\x82\x00\xfe\x07\x00\x00\x28', + b'\x40\x83\x00\xfe\x07\x00\x00\x18', + b'\x2d\x84\x00\xfe\x07\x00\x00\x28', + b'\xdb\x85\x00\xfe\x07\x00\x00\x18', + b'\x4d\x86\x00\xfe\x07\x00\x00\x28', + b'\x35\x87\x00\xfe\x07\x00\x00\x18', + b'\x23\x88\x00\xfe\x07\x00\x00\x28', + b'\x4a\x89\x00\xfe\x07\x00\x00\x28', + b'\xe1\x8a\x00\xfe\x07\x00\x00\x28', + b'\x30\x8b\x00\xfe\x07\x00\x00\x28', + b'\x60\x8c\x00\xfe\x07\x00\x00\x28', + b'\x0d\x8d\x00\xfe\x07\x00\x00\x18', + b'\x8c\x8e\x00\xfe\x07\x00\x00\x18', + b'\x6f\x8f\x00\xfe\x07\x00\x00\x28', + ]) + + def test_vw_mqb_crc_HCA_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "HCA_01", 0x126, [ + b'\x00\x30\x0d\xc0\x05\xfe\x07\x00', + b'\x3e\x31\x54\xc0\x05\xfe\x07\x00', + b'\xa7\x32\xbb\x40\x05\xfe\x07\x00', + b'\x96\x33\x29\xc0\x05\xfe\x07\x00', + b'\x5f\x34\x00\x00\x03\xfe\x07\x00', + b'\x3b\x35\xae\x40\x05\xfe\x07\x00', + b'\xc7\x36\x7a\x40\x05\xfe\x07\x00', + b'\x6f\x37\x76\x40\x05\xfe\x07\x00', + b'\xb1\x38\x00\x00\x03\xfe\x07\x00', + b'\xd5\x39\x00\x00\x03\xfe\x07\x00', + b'\xba\x3a\x69\xc0\x05\xfe\x07\x00', + b'\x65\x3b\x10\x40\x05\xfe\x07\x00', + b'\x49\x3c\x72\xc0\x05\xfe\x07\x00', + b'\xc6\x3d\xdf\x40\x05\xfe\x07\x00', + b'\x1d\x3e\x2c\xc1\x05\xfe\x07\x00', + b'\x9b\x3f\x20\x40\x05\xfe\x07\x00', + ]) + + def test_vw_mqb_crc_GRA_ACC_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "GRA_ACC_01", 0x12B, [ + b'\x86\x40\x80\x2a\x00\x00\x00\x00', + b'\xf4\x41\x80\x2a\x00\x00\x00\x00', + b'\x50\x42\x80\x2a\x00\x00\x00\x00', + b'\x08\x43\x80\x2a\x00\x00\x00\x00', + b'\x88\x44\x80\x2a\x00\x00\x00\x00', + b'\x2d\x45\x80\x2a\x00\x00\x00\x00', + b'\x34\x46\x80\x2a\x00\x00\x00\x00', + b'\x11\x47\x80\x2a\x00\x00\x00\x00', + b'\xc4\x48\x80\x2a\x00\x00\x00\x00', + b'\xcc\x49\x80\x2a\x00\x00\x00\x00', + b'\xdc\x4a\x80\x2a\x00\x00\x00\x00', + b'\x79\x4b\x80\x2a\x00\x00\x00\x00', + b'\x3c\x4c\x80\x2a\x00\x00\x00\x00', + b'\x68\x4d\x80\x2a\x00\x00\x00\x00', + b'\x27\x4e\x80\x2a\x00\x00\x00\x00', + b'\x0d\x4f\x80\x2a\x00\x00\x00\x00', + ]) + + def test_vw_mqb_crc_ACC_07(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_07", 0x12E, [ + b'\xac\xe0\x7f\x00\xfe\x00\xc0\xff', + b'\xa2\xe1\x7f\x00\xfe\x00\xc0\xff', + b'\x6b\xe2\x7f\x00\xfe\x00\xc0\xff', + b'\xf2\xe3\x7f\x00\xfe\x00\xc0\xff', + b'\xd5\xe4\x7f\x00\xfe\x00\xc0\xff', + b'\x35\xe5\x7f\x00\xfe\x00\xc0\xff', + b'\x7f\xe6\x7f\x00\xfe\x00\xc0\xff', + b'\x6c\xe7\x7f\x00\xfe\x00\xc0\xff', + b'\x05\xe8\x7f\x00\xfe\x00\xc0\xff', + b'\x79\xe9\x7f\x00\xfe\x00\xc0\xff', + b'\x25\xea\x7f\x00\xfe\x00\xc0\xff', + b'\xd1\xeb\x7f\x00\xfe\x00\xc0\xff', + b'\x72\xec\x7f\x00\xfe\x00\xc0\xff', + b'\x58\xed\x7f\x00\xfe\x00\xc0\xff', + b'\x82\xee\x7f\x00\xfe\x00\xc0\xff', + b'\x85\xef\x7f\x00\xfe\x00\xc0\xff', + ]) + + def test_vw_mqb_crc_Motor_EV_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "Motor_EV_01", 0x187, [ + b'\x70\x80\x15\x00\x00\x00\x00\xF0', + b'\x07\x81\x15\x00\x00\x00\x00\xF0', + b'\x7A\x82\x15\x00\x00\x00\x00\xF0', + b'\x26\x83\x15\x00\x00\x00\x00\xF0', + b'\xBE\x84\x15\x00\x00\x00\x00\xF0', + b'\x5A\x85\x15\x00\x00\x00\x00\xF0', + b'\xFC\x86\x15\x00\x00\x00\x00\xF0', + b'\x9E\x87\x15\x00\x00\x00\x00\xF0', + b'\xAF\x88\x15\x00\x00\x00\x00\xF0', + b'\x35\x89\x15\x00\x00\x00\x00\xF0', + b'\xC5\x8A\x15\x00\x00\x00\x00\xF0', + b'\x11\x8B\x15\x00\x00\x00\x00\xF0', + b'\xD0\x8C\x15\x00\x00\x00\x00\xF0', + b'\xE8\x8D\x15\x00\x00\x00\x00\xF0', + b'\xF5\x8E\x15\x00\x00\x00\x00\xF0', + b'\x00\x8F\x15\x00\x00\x00\x00\xF0', + ]) + + def test_vw_mqb_crc_SWA_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "SWA_01", 0x30F, [ + b'\x10\x00\x10\x00\x00\x00\x00\x00', + b'\x74\x01\x10\x00\x00\x00\x00\x00', + b'\xD8\x02\x10\x00\x00\x00\x00\x00', + b'\xBC\x03\x10\x00\x00\x00\x00\x00', + b'\xAF\x04\x10\x00\x00\x00\x00\x00', + b'\xCB\x05\x10\x00\x00\x00\x00\x00', + b'\x67\x06\x10\x00\x00\x00\x00\x00', + b'\x03\x07\x10\x00\x00\x00\x00\x00', + b'\x41\x08\x10\x00\x00\x00\x00\x00', + b'\x25\x09\x10\x00\x00\x00\x00\x00', + b'\x89\x0A\x10\x00\x00\x00\x00\x00', + b'\xED\x0B\x10\x00\x00\x00\x00\x00', + b'\xFE\x0C\x10\x00\x00\x00\x00\x00', + b'\x9A\x0D\x10\x00\x00\x00\x00\x00', + b'\x36\x0E\x10\x00\x00\x00\x00\x00', + b'\x52\x0F\x10\x00\x00\x00\x00\x00', + ]) + + def test_vw_mqb_crc_ACC_04(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_04", 0x324, [ + b'\xba\x00\x00\x00\x00\x00\x00\x10', + b'\xde\x01\x00\x00\x00\x00\x00\x10', + b'\x72\x02\x00\x00\x00\x00\x00\x10', + b'\x16\x03\x00\x00\x00\x00\x00\x10', + b'\x05\x04\x00\x00\x00\x00\x00\x10', + b'\x44\x05\x00\x00\x00\x00\x00\x00', + b'\xe8\x06\x00\x00\x00\x00\x00\x00', + b'\xa9\x07\x00\x00\x00\x00\x00\x10', + b'\xeb\x08\x00\x00\x00\x00\x00\x10', + b'\x8f\x09\x00\x00\x00\x00\x00\x10', + b'\x06\x0a\x00\x00\x00\x00\x00\x00', + b'\x47\x0b\x00\x00\x00\x00\x00\x10', + b'\x71\x0c\x00\x00\x00\x00\x00\x00', + b'\x15\x0d\x00\x00\x00\x00\x00\x00', + b'\xb9\x0e\x00\x00\x00\x00\x00\x00', + b'\xdd\x0f\x00\x00\x00\x00\x00\x00', + ]) + + def test_vw_mqb_crc_Klemmen_Status_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "Klemmen_Status_01", 0x3C0, [ + b'\x74\x00\x03\x00', + b'\xc1\x01\x03\x00', + b'\x31\x02\x03\x00', + b'\x84\x03\x03\x00', + b'\xfe\x04\x03\x00', + b'\x4b\x05\x03\x00', + b'\xbb\x06\x03\x00', + b'\x0e\x07\x03\x00', + b'\x4f\x08\x03\x00', + b'\xfa\x09\x03\x00', + b'\x0a\x0a\x03\x00', + b'\xbf\x0b\x03\x00', + b'\xc5\x0c\x03\x00', + b'\x70\x0d\x03\x00', + b'\x80\x0e\x03\x00', + b'\x35\x0f\x03\x00', + ]) + + def test_vw_mqb_crc_ESP_20(self, subtests): + self.verify_vw_mqb_crc(subtests, "ESP_20", 0x65D, [ + b'\x98\x30\x2b\x10\x00\x00\x22\x81', + b'\xc8\x31\x2b\x10\x00\x00\x22\x81', + b'\x9d\x32\x2b\x10\x00\x00\x22\x81', + b'\x1f\x33\x2b\x10\x00\x00\x22\x81', + b'\x6e\x34\x2b\x10\x00\x00\x22\x81', + b'\x61\x35\x2b\x10\x00\x00\x22\x81', + b'\x6f\x36\x2b\x10\x00\x00\x22\x81', + b'\xe5\x37\x2b\x10\x00\x00\x22\x81', + b'\xf8\x38\x2b\x10\x00\x00\x22\x81', + b'\xe1\x39\x2b\x10\x00\x00\x22\x81', + b'\xaa\x3a\x2b\x10\x00\x00\x22\x81', + b'\xe6\x3b\x2b\x10\x00\x00\x22\x81', + b'\xef\x3c\x2b\x10\x00\x00\x22\x81', + b'\xbb\x3d\x2b\x10\x00\x00\x22\x81', + b'\x9b\x3e\x2b\x10\x00\x00\x22\x81', + b'\x72\x3f\x2b\x10\x00\x00\x22\x81', + ])