From 191b8081b2a9f3f9db0131edd270e40166570cfa Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 8 Nov 2022 20:52:35 -0800 Subject: [PATCH] GM Camera: use ECM brake pressed bit (#26400) * GM camera: use ECM brake pressed bit * bump panda and use more reliable bit * bump panda * back to ECMEngineStatus * bump * Update selfdrive/car/gm/carstate.py * bump panda * Update ref_commit --- panda | 2 +- selfdrive/car/gm/carstate.py | 14 +++++++++----- selfdrive/test/process_replay/ref_commit | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/panda b/panda index 1ccdff90c5..281eb7731b 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 1ccdff90c564154489a3394691a4830a4ae19027 +Subproject commit 281eb7731b4338fef049977593fdf3315adf09e9 diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index af69307a2c..f4b3f88e99 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -51,12 +51,15 @@ class CarState(CarStateBase): else: ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(pt_cp.vl["ECMPRDNL2"]["PRNDL2"], None)) - # Some Volt 2016-17 have loose brake pedal push rod retainers which causes the ECM to believe - # that the brake is being intermittently pressed without user interaction. - # To avoid a cruise fault we need to match the ECM's brake pressed signal and threshold - # https://static.nhtsa.gov/odi/tsbs/2017/MC-10137629-9999.pdf ret.brake = pt_cp.vl["ECMAcceleratorPos"]["BrakePedalPos"] - ret.brakePressed = ret.brake >= 8 + if self.CP.networkLocation == NetworkLocation.fwdCamera: + ret.brakePressed = pt_cp.vl["ECMEngineStatus"]["BrakePressed"] != 0 + else: + # Some Volt 2016-17 have loose brake pedal push rod retainers which causes the ECM to believe + # that the brake is being intermittently pressed without user interaction. + # To avoid a cruise fault we need to use a conservative brake position threshold + # https://static.nhtsa.gov/odi/tsbs/2017/MC-10137629-9999.pdf + ret.brakePressed = ret.brake >= 8 # Regen braking is braking if self.CP.transmissionType == TransmissionType.direct: @@ -154,6 +157,7 @@ class CarState(CarStateBase): ("TractionControlOn", "ESPStatus"), ("ParkBrake", "VehicleIgnitionAlt"), ("CruiseMainOn", "ECMEngineStatus"), + ("BrakePressed", "ECMEngineStatus"), ] checks = [ diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 08eb063d41..da954d76a6 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -caa8fb2a046a6c2c186e66af339212a5fae6b7a4 +372a67c524342bbf15e22f0caea08d2038973281