Skip to content

Commit

Permalink
VW MQB: EV_Gearshift -> Motor_EV_01 (#1237)
Browse files Browse the repository at this point in the history
* DBC updates

* update comment in CRC function

* updates to carstate and interface

* update shifter VAL lookup
  • Loading branch information
jyoung8607 authored Sep 12, 2024
1 parent c43cd3a commit d8aba58
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion opendbc/can/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/volkswagen/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/volkswagen/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/volkswagen/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
27 changes: 19 additions & 8 deletions opendbc/dbc/vw_mqb_2010.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)";
Expand Down Expand Up @@ -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" ;
Expand Down

0 comments on commit d8aba58

Please sign in to comment.