mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 03:52:11 +08:00
GM: Fix noisy brake pressed (#23712)
* GM: Use ECMEngineStatus.Brake_Pressed * consistent style * add TODO * bump panda bump panda * it should * bump panda Co-authored-by: Jason Shuler <jshuler@gmail.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: dd76cfcf28f95354e78abc5786db0cef75cb23cf
This commit is contained in:
@@ -30,10 +30,8 @@ class CarState(CarStateBase):
|
||||
ret.standstill = ret.vEgoRaw < 0.01
|
||||
|
||||
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(pt_cp.vl["ECMPRDNL"]["PRNDL"], None))
|
||||
ret.brakePressed = pt_cp.vl["ECMEngineStatus"]["Brake_Pressed"] != 0
|
||||
ret.brake = pt_cp.vl["EBCMBrakePedalPosition"]["BrakePedalPosition"] / 0xd0
|
||||
# Brake pedal's potentiometer returns near-zero reading even when pedal is not pressed.
|
||||
if ret.brake < 10/0xd0:
|
||||
ret.brake = 0.
|
||||
|
||||
ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254.
|
||||
ret.gasPressed = ret.gas > 1e-5
|
||||
@@ -62,14 +60,13 @@ class CarState(CarStateBase):
|
||||
ret.rightBlinker = pt_cp.vl["BCMTurnSignals"]["TurnSignals"] == 2
|
||||
|
||||
self.park_brake = pt_cp.vl["EPBStatus"]["EPBClosed"]
|
||||
ret.cruiseState.available = bool(pt_cp.vl["ECMEngineStatus"]["CruiseMainOn"])
|
||||
ret.cruiseState.available = pt_cp.vl["ECMEngineStatus"]["CruiseMainOn"] != 0
|
||||
ret.espDisabled = pt_cp.vl["ESPStatus"]["TractionControlOn"] != 1
|
||||
self.pcm_acc_status = pt_cp.vl["AcceleratorPedal2"]["CruiseState"]
|
||||
|
||||
ret.brakePressed = ret.brake > 1e-5
|
||||
# Regen braking is braking
|
||||
if self.car_fingerprint == CAR.VOLT:
|
||||
ret.brakePressed = ret.brakePressed or bool(pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"])
|
||||
ret.brakePressed = ret.brakePressed or pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0
|
||||
|
||||
ret.cruiseState.enabled = self.pcm_acc_status != AccState.OFF
|
||||
ret.cruiseState.standstill = self.pcm_acc_status == AccState.STANDSTILL
|
||||
@@ -104,6 +101,7 @@ class CarState(CarStateBase):
|
||||
("TractionControlOn", "ESPStatus"),
|
||||
("EPBClosed", "EPBStatus"),
|
||||
("CruiseMainOn", "ECMEngineStatus"),
|
||||
("Brake_Pressed", "ECMEngineStatus"),
|
||||
]
|
||||
|
||||
checks = [
|
||||
|
||||
Reference in New Issue
Block a user