Chrysler: fix LKAS fault for 2017 Pacifica
diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py
index 5a2d90c64c2410..879da8812376ad 100644
--- a/selfdrive/car/chrysler/carcontroller.py
+++ b/selfdrive/car/chrysler/carcontroller.py
@@ -2,7 +2,7 @@
 from common.realtime import DT_CTRL
 from selfdrive.car import apply_toyota_steer_torque_limits
 from selfdrive.car.chrysler.chryslercan import create_lkas_hud, create_lkas_command, create_cruise_buttons
-from selfdrive.car.chrysler.values import CAR, RAM_CARS, CarControllerParams
+from selfdrive.car.chrysler.values import RAM_CARS, CarControllerParams, ChryslerFlags
 
 
 class CarController:
@@ -51,7 +51,7 @@ def update(self, CC, CS):
       lkas_control_bit = self.lkas_control_bit_prev
       if CS.out.vEgo > self.CP.minSteerSpeed:
         lkas_control_bit = True
-      elif self.CP.carFingerprint in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019):
+      elif self.CP.flags & ChryslerFlags.HIGHER_MIN_STEERING_SPEED:
         if CS.out.vEgo < (self.CP.minSteerSpeed - 3.0):
           lkas_control_bit = False
       elif self.CP.carFingerprint in RAM_CARS:
diff --git a/selfdrive/car/chrysler/interface.py b/selfdrive/car/chrysler/interface.py
index 5e8fe3c44ef9a8..2f058165ac96e0 100755
--- a/selfdrive/car/chrysler/interface.py
+++ b/selfdrive/car/chrysler/interface.py
@@ -2,7 +2,7 @@
 from cereal import car
 from panda import Panda
 from selfdrive.car import STD_CARGO_KG, get_safety_config
-from selfdrive.car.chrysler.values import CAR, DBC, RAM_HD, RAM_DT
+from selfdrive.car.chrysler.values import CAR, DBC, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags
 from selfdrive.car.interfaces import CarInterfaceBase
 
 
@@ -24,9 +24,12 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
       ret.safetyConfigs[0].safetyParam |= Panda.FLAG_CHRYSLER_RAM_DT
 
     ret.minSteerSpeed = 3.8  # m/s
-    if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019):
-      # TODO: allow 2019 cars to steer down to 13 m/s if already engaged.
-      ret.minSteerSpeed = 17.5  # m/s 17 on the way up, 13 on the way down once engaged.
+    if candidate not in RAM_CARS:
+      # Newer FW versions standard on the following platforms, or flashed by a dealer onto older platforms have a higher minimum steering speed.
+      new_eps_platform = candidate in (CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020, CAR.JEEP_CHEROKEE_2019)
+      new_eps_firmware = any(fw.ecu == 'eps' and fw.fwVersion[:4] >= b"6841" for fw in car_fw)
+      if new_eps_platform or new_eps_firmware:
+        ret.flags |= ChryslerFlags.HIGHER_MIN_STEERING_SPEED.value
 
     # Chrysler
     if candidate in (CAR.PACIFICA_2017_HYBRID, CAR.PACIFICA_2018, CAR.PACIFICA_2018_HYBRID, CAR.PACIFICA_2019_HYBRID, CAR.PACIFICA_2020):
@@ -55,10 +58,9 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
       ret.mass = 2493. + STD_CARGO_KG
       CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
       ret.minSteerSpeed = 14.5
-      if car_fw is not None:
-        for fw in car_fw:
-          if fw.ecu == 'eps' and fw.fwVersion[:8] in (b"68312176", b"68273275"):
-            ret.minSteerSpeed = 0.
+      for fw in car_fw:
+        if fw.ecu == 'eps' and fw.fwVersion.startswith((b"68312176", b"68273275")):
+          ret.minSteerSpeed = 0.
 
     elif candidate == CAR.RAM_HD:
       ret.steerActuatorDelay = 0.2
@@ -71,6 +73,10 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long):
     else:
       raise ValueError(f"Unsupported car: {candidate}")
 
+    if ret.flags & ChryslerFlags.HIGHER_MIN_STEERING_SPEED:
+      # TODO: allow these cars to steer down to 13 m/s if already engaged.
+      ret.minSteerSpeed = 17.5  # m/s 17 on the way up, 13 on the way down once engaged.
+
     ret.centerToFront = ret.wheelbase * 0.44
     ret.enableBsm = 720 in fingerprint[0]
 
diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py
index 16530ed9894956..02261a0b633587 100644
--- a/selfdrive/car/chrysler/values.py
+++ b/selfdrive/car/chrysler/values.py
@@ -1,3 +1,4 @@
+from enum import IntFlag
 from dataclasses import dataclass
 from enum import Enum
 from typing import Dict, List, Optional, Union
@@ -11,6 +12,10 @@
 Ecu = car.CarParams.Ecu
 
 
+class ChryslerFlags(IntFlag):
+  HIGHER_MIN_STEERING_SPEED = 1
+
+
 class CAR:
   # Chrysler
   PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017"

fritzie29#1365 on Discord has a 2017 Pacifica with newer 2020 EPS firmware, meaning that the dealer likely reflashed their EPS while taking it in for service, raising their min steer speed unfortunately. We can't gate this on platform any more, since it can be different based on the EPS firmware.

I quickly went through all our EPS firmwares, and this seems right, but will do a second check.

EDIT: False alarm, this user reports that he had his entire rack and pinion replaced, and his dongle is the only one with this updated firmware, so it's unlikely this will become a widespread phenomenon. PR now only includes his FW and abstracts the higher steering speed limit into a flag

EDIT 2: Actually I have a report of another user with a 2017 having their EPS flashed by a dealer only to find out they can't use LKAS under 30 any more. They got the dealer to flash them back and now can use at 9 mph again. The dealer told them to avoid having their EPS flashed. So it is possible for dealers to flash old EPS's, just exceedingly rare it appears.

![Screenshot from 2022-12-05 22-03-21](https://user-images.githubusercontent.com/25857203/205832983-a11ab953-dca9-461f-82cb-6e601fdaaa8f.png)