@ -51,11 +51,8 @@ class CarState(CarStateBase):
ret . cruiseState . available = cp . vl [ " CruiseControl " ] [ " Cruise_On " ] != 0
ret . cruiseState . available = cp . vl [ " CruiseControl " ] [ " Cruise_On " ] != 0
ret . cruiseState . speed = cp_cam . vl [ " ES_DashStatus " ] [ " Cruise_Set_Speed " ] * CV . KPH_TO_MS
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 PREGLOBAL_CARS and cp . vl [ " Dash_State2 " ] [ " UNITS " ] == 1 ) or \
if self . car_fingerprint in [ CAR . FORESTER_PREGLOBAL , CAR . LEGACY_PREGLOBAL ] and cp . vl [ " Dash_State " ] [ " Units " ] == 0 :
( self . car_fingerprint not in PREGLOBAL_CARS and cp . vl [ " Dashlights " ] [ " UNITS " ] == 1 ) :
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 ] :
ret . cruiseState . speed * = CV . MPH_TO_KPH
ret . cruiseState . speed * = CV . MPH_TO_KPH
ret . seatbeltUnlatched = cp . vl [ " Dashlights " ] [ " SEATBELT_FL " ] == 1
ret . seatbeltUnlatched = cp . vl [ " Dashlights " ] [ " SEATBELT_FL " ] == 1
@ -100,7 +97,6 @@ class CarState(CarStateBase):
( " DOOR_OPEN_FL " , " BodyInfo " , 1 ) ,
( " DOOR_OPEN_FL " , " BodyInfo " , 1 ) ,
( " DOOR_OPEN_RR " , " BodyInfo " , 1 ) ,
( " DOOR_OPEN_RR " , " BodyInfo " , 1 ) ,
( " DOOR_OPEN_RL " , " BodyInfo " , 1 ) ,
( " DOOR_OPEN_RL " , " BodyInfo " , 1 ) ,
( " Units " , " Dash_State " , 1 ) ,
( " Gear " , " Transmission " , 0 ) ,
( " Gear " , " Transmission " , 0 ) ,
]
]
@ -112,7 +108,6 @@ class CarState(CarStateBase):
( " Wheel_Speeds " , 50 ) ,
( " Wheel_Speeds " , 50 ) ,
( " Transmission " , 100 ) ,
( " Transmission " , 100 ) ,
( " Steering_Torque " , 50 ) ,
( " Steering_Torque " , 50 ) ,
( " Dash_State " , 1 ) ,
( " BodyInfo " , 1 ) ,
( " BodyInfo " , 1 ) ,
]
]
@ -130,6 +125,7 @@ class CarState(CarStateBase):
if CP . carFingerprint not in PREGLOBAL_CARS :
if CP . carFingerprint not in PREGLOBAL_CARS :
signals + = [
signals + = [
( " Steer_Warning " , " Steering_Torque " , 0 ) ,
( " Steer_Warning " , " Steering_Torque " , 0 ) ,
( " UNITS " , " Dashlights " , 0 ) ,
]
]
checks + = [
checks + = [
@ -137,6 +133,14 @@ class CarState(CarStateBase):
( " BodyInfo " , 10 ) ,
( " BodyInfo " , 10 ) ,
( " CruiseControl " , 20 ) ,
( " CruiseControl " , 20 ) ,
]
]
else :
signals + = [
( " UNITS " , " Dash_State2 " , 0 ) ,
]
checks + = [
( " Dash_State2 " , 1 ) ,
]
if CP . carFingerprint == CAR . FORESTER_PREGLOBAL :
if CP . carFingerprint == CAR . FORESTER_PREGLOBAL :
checks + = [
checks + = [