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/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.)) 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, 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() 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])