Subaru: universal signal for ACC speed units (#21995)

* Change ACC Speed Units signals for Global and Pre-Global

* Use Dash_State UNITS signal for Preglobal

* Change Subaru Preglobal to use Dash_State2 UNITS signal

* bump opendbc

* cleanup

* update refs

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
martinl
2021-09-03 00:21:35 +03:00
committed by GitHub
parent 7db04ab0c5
commit d3113fe01a
3 changed files with 13 additions and 9 deletions
+1 -1
Submodule opendbc updated: 3afceadb84...78c639f813
+11 -7
View File
@@ -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 += [
+1 -1
View File
@@ -1 +1 @@
9f181202bbd6c64330bf4903ec265a179201057c
858ebd51d52e76edf61190014337df299a7e6374