From 682f16d1b5c9c5d618711d864a16efde80af8e14 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Sun, 10 Mar 2024 04:54:54 +0000 Subject: [PATCH 1/4] Ford: fix counter in LateralMotionControl2 message (#31806) The counter should be between 0-15 inclusive. This only affects CAN FD cars. --- selfdrive/car/ford/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py index 390325a8ec..7ce2ded6e3 100644 --- a/selfdrive/car/ford/carcontroller.py +++ b/selfdrive/car/ford/carcontroller.py @@ -73,7 +73,7 @@ class CarController(CarControllerBase): if self.CP.flags & FordFlags.CANFD: # TODO: extended mode mode = 1 if CC.latActive else 0 - counter = (self.frame // CarControllerParams.STEER_STEP) % 0xF + counter = (self.frame // CarControllerParams.STEER_STEP) % 0x10 can_sends.append(fordcan.create_lat_ctl2_msg(self.packer, self.CAN, mode, 0., 0., -apply_curvature, 0., counter)) else: can_sends.append(fordcan.create_lat_ctl_msg(self.packer, self.CAN, CC.latActive, 0., 0., -apply_curvature, 0.)) From 5ca733c41525b1c796e00a09518cea74f0bd0436 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 10 Mar 2024 00:00:32 -0500 Subject: [PATCH 2/4] GM: Parse distance button from steering wheel (#31762) --- selfdrive/car/gm/carstate.py | 5 +++++ selfdrive/car/gm/interface.py | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index c3d061de78..a1129c59c8 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -26,11 +26,16 @@ class CarState(CarStateBase): self.cam_lka_steering_cmd_counter = 0 self.buttons_counter = 0 + self.prev_distance_button = 0 + self.distance_button = 0 + def update(self, pt_cp, cam_cp, loopback_cp): ret = car.CarState.new_message() self.prev_cruise_buttons = self.cruise_buttons + self.prev_distance_button = self.distance_button self.cruise_buttons = pt_cp.vl["ASCMSteeringButton"]["ACCButtons"] + self.distance_button = pt_cp.vl["ASCMSteeringButton"]["DistanceButton"] self.buttons_counter = pt_cp.vl["ASCMSteeringButton"]["RollingCounter"] self.pscm_status = copy.copy(pt_cp.vl["PSCMStatus"]) # This is to avoid a fault where you engage while still moving backwards after shifting to D. diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 76f6a6b0a6..1336e23c70 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -208,8 +208,12 @@ class CarInterface(CarInterfaceBase): # Don't add event if transitioning from INIT, unless it's to an actual button if self.CS.cruise_buttons != CruiseButtons.UNPRESS or self.CS.prev_cruise_buttons != CruiseButtons.INIT: - ret.buttonEvents = create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT, - unpressed_btn=CruiseButtons.UNPRESS) + ret.buttonEvents = [ + *create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT, + unpressed_btn=CruiseButtons.UNPRESS), + *create_button_events(self.CS.distance_button, self.CS.prev_distance_button, + {1: ButtonType.gapAdjustCruise}) + ] # The ECM allows enabling on falling edge of set, but only rising edge of resume events = self.create_common_events(ret, extra_gears=[GearShifter.sport, GearShifter.low, From 1fe61569f720a30db58379b451452b84239c2e37 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 9 Mar 2024 23:31:50 -0800 Subject: [PATCH 3/4] fix status -> state typo --- selfdrive/ui/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/ui/ui.py b/selfdrive/ui/ui.py index ea2ee51a45..660495b1de 100755 --- a/selfdrive/ui/ui.py +++ b/selfdrive/ui/ui.py @@ -52,7 +52,7 @@ if __name__ == "__main__": onroad = sm.all_checks(['deviceState']) and sm['deviceState'].started if onroad: cs = sm['controlsState'] - color = ("grey" if str(cs.status) in ("overriding", "preEnabled") else "green") if cs.enabled else "blue" + color = ("grey" if str(cs.state) in ("overriding", "preEnabled") else "green") if cs.enabled else "blue" bg.setText("\U0001F44D" if cs.engageable else "\U0001F6D1") bg.setStyleSheet(f"font-size: 100px; background-color: {color};") bg.show() From 4d1b1001526970012364b843cbbb997bfd983842 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 9 Mar 2024 23:33:24 -0800 Subject: [PATCH 4/4] cgpsd: use a real source --- cereal | 2 +- system/qcomgpsd/cgpsd.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cereal b/cereal index cf7bb3e749..93d3df3210 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit cf7bb3e74974879abef94286fab4d39398fe402b +Subproject commit 93d3df3210a8c4f4c7e6f45950f73dc8a2f09a2c diff --git a/system/qcomgpsd/cgpsd.py b/system/qcomgpsd/cgpsd.py index 04a92d4a45..54d3c623f3 100755 --- a/system/qcomgpsd/cgpsd.py +++ b/system/qcomgpsd/cgpsd.py @@ -57,6 +57,10 @@ def main(): # TODO: read from streaming AT port instead of polling out = at_cmd("AT+CGPS?") + if '+CGPS: 1' not in out: + for c in cmds: + at_cmd(c) + sentences = out.split("'")[1].splitlines() new = {l.split(',')[0]: l.split(',') for l in sentences if l.startswith('$G')} nmea.update(new) @@ -85,8 +89,7 @@ def main(): gps.hasFix = gnrmc[1] == 'A' - # TODO: make our own source - gps.source = log.GpsLocationData.SensorSource.qcomdiag + gps.source = log.GpsLocationData.SensorSource.unicore gps.speed = sfloat(gnrmc[7]) gps.bearingDeg = sfloat(gnrmc[8])