From 9f327aeb4824576497a57f077fe9b8243b95e8c0 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Wed, 22 May 2024 01:01:04 +0100 Subject: [PATCH] Ford: detect missing LKAS from EPS configuration (#31821) * debug: disable FW cache * Ford: detect missing TJA/LCA config and disable LKAS * set dashcamOnly * revert * clean up * clean up * some CAN FD do not have 0x01 block for PSCM * bump cereal (fork) * remove confusing comment * add flags/event * remove duplicate from events * copy can be next pr * dashcamOnly if no config comes back either (this shouldn't happen) * flipped * can do this * Revert "can do this" This reverts commit c3d311b2ffb7bbc346c7f702ac5c1934bc495c65. * Revert "flipped" This reverts commit 75c01fb4c5f7fdc9222ea13b8901f76b5b419c99. * Revert "dashcamOnly if no config comes back either (this shouldn't happen)" This reverts commit f82624a0eb28bf683660f86b3ddfd44717a6915f. --------- Co-authored-by: Shane Smiskol --- selfdrive/car/ford/interface.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index 7dca458083..1ae57965e7 100644 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -39,6 +39,18 @@ class CarInterface(CarInterfaceBase): if ret.flags & FordFlags.CANFD: ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_FORD_CANFD + else: + # Lock out if the car does not have needed lateral and longitudinal control APIs. + # Note that we also check CAN for adaptive cruise, but no known signal for LCA exists + pscm_config = next((fw for fw in car_fw if fw.ecu == Ecu.eps and b'\x22\xDE\x01' in fw.request), None) + if pscm_config: + if len(pscm_config.response) != 24: + ret.dashcamOnly = True + else: + config_tja = pscm_config.response[7] # Traffic Jam Assist + config_lca = pscm_config.response[8] # Lane Centering Assist + if config_tja != 0xFF or config_lca != 0xFF: + ret.dashcamOnly = True # Auto Transmission: 0x732 ECU or Gear_Shift_by_Wire_FD1 found_ecus = [fw.ecu for fw in car_fw]