diff --git a/opendbc b/opendbc index 3afceadb84..78c639f813 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 3afceadb847346feb30d96506f482f536e36281d +Subproject commit 78c639f813430d422bc04d06ac78242c3475bed6 diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py index d2fa0c7958..6e307562aa 100644 --- a/selfdrive/car/subaru/carstate.py +++ b/selfdrive/car/subaru/carstate.py @@ -51,11 +51,8 @@ class CarState(CarStateBase): ret.cruiseState.available = cp.vl["CruiseControl"]["Cruise_On"] != 0 ret.cruiseState.speed = cp_cam.vl["ES_DashStatus"]["Cruise_Set_Speed"] * CV.KPH_TO_MS - # UDM Forester, Legacy: mph = 0 - if self.car_fingerprint in [CAR.FORESTER_PREGLOBAL, CAR.LEGACY_PREGLOBAL] and cp.vl["Dash_State"]["Units"] == 0: - ret.cruiseState.speed *= CV.MPH_TO_KPH - # EDM Global: mph = 1, 2; All Outback: mph = 1, UDM Forester: mph = 7 - elif self.car_fingerprint not in [CAR.FORESTER_PREGLOBAL, CAR.LEGACY_PREGLOBAL] and cp.vl["Dash_State"]["Units"] in [1, 2, 7]: + if (self.car_fingerprint in PREGLOBAL_CARS and cp.vl["Dash_State2"]["UNITS"] == 1) or \ + (self.car_fingerprint not in PREGLOBAL_CARS and cp.vl["Dashlights"]["UNITS"] == 1): ret.cruiseState.speed *= CV.MPH_TO_KPH ret.seatbeltUnlatched = cp.vl["Dashlights"]["SEATBELT_FL"] == 1 @@ -100,7 +97,6 @@ class CarState(CarStateBase): ("DOOR_OPEN_FL", "BodyInfo", 1), ("DOOR_OPEN_RR", "BodyInfo", 1), ("DOOR_OPEN_RL", "BodyInfo", 1), - ("Units", "Dash_State", 1), ("Gear", "Transmission", 0), ] @@ -112,7 +108,6 @@ class CarState(CarStateBase): ("Wheel_Speeds", 50), ("Transmission", 100), ("Steering_Torque", 50), - ("Dash_State", 1), ("BodyInfo", 1), ] @@ -130,6 +125,7 @@ class CarState(CarStateBase): if CP.carFingerprint not in PREGLOBAL_CARS: signals += [ ("Steer_Warning", "Steering_Torque", 0), + ("UNITS", "Dashlights", 0), ] checks += [ @@ -137,6 +133,14 @@ class CarState(CarStateBase): ("BodyInfo", 10), ("CruiseControl", 20), ] + else: + signals += [ + ("UNITS", "Dash_State2", 0), + ] + + checks += [ + ("Dash_State2", 1), + ] if CP.carFingerprint == CAR.FORESTER_PREGLOBAL: checks += [ diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index c33901e2c7..3023fb4026 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -9f181202bbd6c64330bf4903ec265a179201057c \ No newline at end of file +858ebd51d52e76edf61190014337df299a7e6374 \ No newline at end of file