From 98dbd3920938fc8aed6ab22d3075ba533486c85d Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 3 Oct 2023 21:38:52 +0000 Subject: [PATCH] Mazda: Custom Stock Longitudinal Control: calculate counters manually --- selfdrive/car/mazda/carcontroller.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/mazda/carcontroller.py b/selfdrive/car/mazda/carcontroller.py index 2efb00e014..488d30205b 100644 --- a/selfdrive/car/mazda/carcontroller.py +++ b/selfdrive/car/mazda/carcontroller.py @@ -110,10 +110,11 @@ class CarController: # Mazda Stop and Go requires a RES button (or gas) press if the car stops more than 3 seconds # Send Resume button when planner wants car to move can_sends.append(mazdacan.create_button_cmd(self.packer, self.CP.carFingerprint, CS.crz_btns_counter, Buttons.RESUME)) - elif CS.out.cruiseState.enabled and not self.CP.pcmCruiseSpeed and self.frame % 10 == 0: + elif CS.out.cruiseState.enabled and not self.CP.pcmCruiseSpeed: self.cruise_button = self.get_cruise_buttons(CS, CC.vCruise) if self.cruise_button is not None: - can_sends.append(mazdacan.create_button_cmd(self.packer, self.CP.carFingerprint, CS.crz_btns_counter, self.cruise_button)) + if self.frame % 10 == 0: + can_sends.append(mazdacan.create_button_cmd(self.packer, self.CP.carFingerprint, self.frame // 10, self.cruise_button)) self.apply_steer_last = apply_steer