add flags/event

pull/31821/head
Cameron Clough 1 year ago
parent 8dc602b1b2
commit 0e72b1dd9c
  1. 4
      selfdrive/car/ford/interface.py
  2. 2
      selfdrive/car/ford/values.py
  3. 5
      selfdrive/controls/lib/events.py

@ -45,11 +45,13 @@ class CarInterface(CarInterfaceBase):
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.flags |= FordFlags.LKAS_UNAVAILABLE
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.flags |= FordFlags.LKAS_UNAVAILABLE
ret.dashcamOnly = True
# Auto Transmission: 0x732 ECU or Gear_Shift_by_Wire_FD1
@ -79,6 +81,8 @@ class CarInterface(CarInterfaceBase):
events = self.create_common_events(ret, extra_gears=[GearShifter.manumatic])
if not self.CS.vehicle_sensors_valid:
events.add(car.CarEvent.EventName.vehicleSensorsInvalid)
elif self.CP.flags & FordFlags.LKAS_UNAVAILABLE:
events.add(car.CarEvent.EventName.actuatorsApiUnavailable)
ret.events = events.to_msg()

@ -44,6 +44,8 @@ class CarControllerParams:
class FordFlags(IntFlag):
# Static flags
CANFD = 1
# Dynamic flags
LKAS_UNAVAILABLE = 2
class RADAR:

@ -950,6 +950,11 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.NO_ENTRY: NoEntryAlert("Vehicle Sensors Calibrating"),
},
EventName.actuatorsApiUnavailable: {
ET.PERMANENT: NormalPermanentAlert("Missing Actuators API", "Your car may not be supported"),
ET.NO_ENTRY: NoEntryAlert("Missing Actuators API", "Your car may not be supported"),
},
}

Loading…
Cancel
Save