From 96e4b39ed39a2b4e41e45cf395c61f15343ec44a Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 9 Aug 2022 22:56:46 -0700 Subject: [PATCH] try spamming buttons on bus 2 --- selfdrive/car/gm/carcontroller.py | 10 +++++++++- selfdrive/car/gm/gmcan.py | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index c737863a74..b6a853a514 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -5,7 +5,7 @@ from common.realtime import DT_CTRL from opendbc.can.packer import CANPacker from selfdrive.car import apply_std_steer_torque_limits from selfdrive.car.gm import gmcan -from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, EV_CAR +from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons, EV_CAR VisualAlert = car.CarControl.HUDControl.VisualAlert NetworkLocation = car.CarParams.NetworkLocation @@ -107,6 +107,14 @@ class CarController: if self.CP.networkLocation == NetworkLocation.gateway and self.frame % self.params.ADAS_KEEPALIVE_STEP == 0: can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN) + elif self.CP.networkLocation == NetworkLocation.fwdCamera: + # Stock longitudinal, integrated at camera + if self.frame % 3 == 0: + if CC.cruiseControl.cancel: + can_sends.append(gmcan.create_buttons(self.packer_pt, CruiseButtons.CANCEL)) + elif CC.cruiseControl.resume: + can_sends.append(gmcan.create_buttons(self.packer_pt, CruiseButtons.RES_ACCEL)) + # Show green icon when LKA torque is applied, and # alarming orange icon when approaching torque limit. # If not sent again, LKA icon disappears in about 5 seconds. diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py index 47e6090a03..63e3408e6b 100644 --- a/selfdrive/car/gm/gmcan.py +++ b/selfdrive/car/gm/gmcan.py @@ -1,5 +1,10 @@ from selfdrive.car import make_can_msg +def create_buttons(packer, button): + values = {} # ascm_steering_button + values["ACCButtons"] = button + return packer.make_can_msg("ASCMSteeringButton", 2, values) + def create_steering_control(packer, bus, apply_steer, idx, lkas_active): values = {