From 1df072cd3ab4df1ca1745d8e471261b6f6af6acb Mon Sep 17 00:00:00 2001 From: Jason Young <46612682+jyoung8607@users.noreply.github.com> Date: Thu, 9 Sep 2021 19:49:31 -0500 Subject: [PATCH] VW MQB: Fixes for network location detection (#22174) * VW MQB: Fixes for network location detection * apply review suggestion Co-authored-by: Adeeb Shihadeh * FP back to 100ms; VIN state poll at 50Hz Co-authored-by: Adeeb Shihadeh old-commit-hash: 5a4d03da29b3afe428c8add57b8bfb36b185dd12 --- selfdrive/boardd/boardd.cc | 4 ++-- selfdrive/car/volkswagen/interface.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 3f09ec9493..02f6940a80 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -61,7 +61,7 @@ void safety_setter_thread(Panda *panda) { LOGW("got CarVin %s", value_vin.c_str()); break; } - util::sleep_for(100); + util::sleep_for(20); } // VIN query done, stop listening to OBDII @@ -170,7 +170,7 @@ static Panda *usb_retry_connect() { LOGW("connected to board"); return panda; } - util::sleep_for(100); + util::sleep_for(100); }; return nullptr; } diff --git a/selfdrive/car/volkswagen/interface.py b/selfdrive/car/volkswagen/interface.py index 0f3fa8a4a0..fa1c236c7f 100644 --- a/selfdrive/car/volkswagen/interface.py +++ b/selfdrive/car/volkswagen/interface.py @@ -30,18 +30,18 @@ class CarInterface(CarInterfaceBase): if True: # pylint: disable=using-constant-test # Set global MQB parameters ret.safetyModel = car.CarParams.SafetyModel.volkswagen - ret.enableBsm = 0x30F in fingerprint[0] + ret.enableBsm = 0x30F in fingerprint[0] # SWA_01 if 0xAD in fingerprint[0]: # Getriebe_11 ret.transmissionType = TransmissionType.automatic elif 0x187 in fingerprint[0]: # EV_Gearshift ret.transmissionType = TransmissionType.direct - else: # No trans message at all, must be a true stick-shift manual + else: ret.transmissionType = TransmissionType.manual - if 0x86 in fingerprint[1]: # LWI_01 seen on bus 1, we're wired to the CAN gateway + if any(msg in fingerprint[1] for msg in [0x40, 0x86, 0xB2]): # Airbag_01, LWI_01, ESP_19 ret.networkLocation = NetworkLocation.gateway - else: # We're wired to the LKAS camera + else: ret.networkLocation = NetworkLocation.fwdCamera # Global tuning defaults, can be overridden per-vehicle