Ford: handle metric cruise speed (v2)

**Description**

I found a signal which appears to match the IPC "Show km/h" setting.
Requires https://github.com/commaai/opendbc/pull/1010.

**Verification**

- [ ] Test in car and confirm that toggling the "Show km/h" setting does
  not result in the cruise speed shown in openpilot being incorrect.
- [ ] Test in a non-English (metric) car.
pull/31463/head
Cameron Clough 1 year ago
parent f6665f8488
commit 3048f2fc80
  1. 4
      selfdrive/car/ford/carstate.py

@ -57,7 +57,8 @@ class CarState(CarStateBase):
ret.steerFaultTemporary |= cp.vl["Lane_Assist_Data3_FD1"]["LatCtlSte_D_Stat"] not in (1, 2, 3)
# cruise state
ret.cruiseState.speed = cp.vl["EngBrakeData"]["Veh_V_DsplyCcSet"] * CV.MPH_TO_MS
is_metric = cp.vl["INSTRUMENT_PANEL"]["METRIC_UNITS"] == 1
ret.cruiseState.speed = cp.vl["EngBrakeData"]["Veh_V_DsplyCcSet"] * (CV.KPH_TO_MS if is_metric else CV.MPH_TO_MS)
ret.cruiseState.enabled = cp.vl["EngBrakeData"]["CcStat_D_Actl"] in (4, 5)
ret.cruiseState.available = cp.vl["EngBrakeData"]["CcStat_D_Actl"] in (3, 4, 5)
ret.cruiseState.nonAdaptive = cp.vl["Cluster_Info1_FD1"]["AccEnbl_B_RqDrv"] == 0
@ -120,6 +121,7 @@ class CarState(CarStateBase):
("BrakeSnData_4", 50),
("EngBrakeData", 10),
("Cluster_Info1_FD1", 10),
("INSTRUMENT_PANEL", 10),
("SteeringPinion_Data", 100),
("EPAS_INFO", 50),
("Steering_Data_FD1", 10),

Loading…
Cancel
Save