Ford: handle metric cruise speed (v2) (#31463)

* 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.

* not present on Q4

* fix freq

* test

* Revert "test"

This reverts commit 5e3a9f6df1.

* Update ref_commit

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: b59ae50961
pull/32199/head
Cameron Clough 1 year ago committed by GitHub
parent 21cce04a21
commit 6f9c3f88cd
  1. 7
      selfdrive/car/ford/carstate.py
  2. 2
      selfdrive/test/process_replay/ref_commit

@ -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 if not self.CP.flags & FordFlags.CANFD else False
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
@ -131,6 +132,10 @@ class CarState(CarStateBase):
messages += [
("Lane_Assist_Data3_FD1", 33),
]
else:
messages += [
("INSTRUMENT_PANEL", 1),
]
if CP.transmissionType == TransmissionType.automatic:
messages += [

@ -1 +1 @@
4e5e37be9d70450154f8b100ed88151bb3612331
f77699bfd783ab0c9a419f2af883b36aed20cc68
Loading…
Cancel
Save