diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index 4184540f07..0c2ed38719 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -1,3 +1,4 @@ +import copy from cereal import car from common.conversions import Conversions as CV from common.numpy_fast import mean @@ -59,7 +60,7 @@ class CarState(CarStateBase): self.lka_steering_cmd_counter = loopback_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"] # 0 inactive, 1 active, 2 temporarily limited, 3 failed - self.pscm_status = pt_cp.vl["PSCMStatus"] + self.pscm_status = copy.copy(pt_cp.vl["PSCMStatus"]) self.lkas_status = pt_cp.vl["PSCMStatus"]["LKATorqueDeliveredStatus"] ret.steerFaultTemporary = self.lkas_status == 2 ret.steerFaultPermanent = self.lkas_status == 3 @@ -127,11 +128,8 @@ class CarState(CarStateBase): ("LKADriverAppldTrq", "PSCMStatus"), ("LKATorqueDelivered", "PSCMStatus"), ("LKATotalTorqueDelivered", "PSCMStatus"), - ("NEW_SIGNAL_1", "PSCMStatus"), - ("NEW_SIGNAL_2", "PSCMStatus"), - ("NEW_SIGNAL_3", "PSCMStatus"), - ("NEW_SIGNAL_4", "PSCMStatus"), - ("NEW_SIGNAL_5", "PSCMStatus"), + ("PSCMStatusChecksum", "PSCMStatus"), + ("RollingCounter", "PSCMStatus"), ("TractionControlOn", "ESPStatus"), ("ParkBrake", "VehicleIgnitionAlt"), ("CruiseMainOn", "ECMEngineStatus"), diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py index ccdcf61446..09dae90a04 100644 --- a/selfdrive/car/gm/gmcan.py +++ b/selfdrive/car/gm/gmcan.py @@ -8,14 +8,11 @@ def create_buttons(packer, bus, idx, button): } return packer.make_can_msg("ASCMSteeringButton", bus, values) - def create_pscm_status(packer, pscm_status): - values = pscm_status.copy() - values["LKATotalTorqueDelivered"] = 0 - values["LKATorqueDeliveredStatus"] = 0 - values["LKATorqueDelivered"] = 0 - # TODO: see if this works instead - # values["HandsOffSWlDetectionStatus"] = 1 + values = pscm_status + checksum_mod = (1 - values["HandsOffSWlDetectionStatus"]) << 5 + values["HandsOffSWlDetectionStatus"] = 1 + values["PSCMStatusChecksum"] += checksum_mod return packer.make_can_msg("PSCMStatus", 2, values) def create_steering_control(packer, bus, apply_steer, idx, lkas_active):