From 49e425ad41f9041936aeb0945b0f758a0e42b051 Mon Sep 17 00:00:00 2001 From: Carlin Hefner Date: Thu, 8 Aug 2024 09:15:48 -0600 Subject: [PATCH] Use proper double-click signal for mads --- opendbc_repo | 2 +- selfdrive/car/tesla/interface.py | 10 +--------- selfdrive/car/tesla/values.py | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index d3cdde5f19d87a..a09b2381aafdc5 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit d3cdde5f19d87a2853874b3fa1c5c5e277d9d7f8 +Subproject commit a09b2381aafdc575e82d5321d13f93002938abe1 diff --git a/selfdrive/car/tesla/interface.py b/selfdrive/car/tesla/interface.py index a78a5074a8bdce..5eb140842d5c6b 100755 --- a/selfdrive/car/tesla/interface.py +++ b/selfdrive/car/tesla/interface.py @@ -12,7 +12,6 @@ class CarInterface(CarInterfaceBase): def __init__(self, CP, CarController, CarState): super().__init__(CP, CarController, CarState) - self.last_mads_press = -1 @staticmethod def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): @@ -44,14 +43,7 @@ def _update(self, c): if self.enable_mads: for b in self.CS.button_events: if b.type == ButtonType.altButton2 and not b.pressed: - # MADS button (right scroll wheel click) is used for voice command - # So we use double-click to toggle MADS - now = time.monotonic() - if now - self.last_mads_press < 1.0: - self.CS.madsEnabled = not self.CS.madsEnabled - self.last_mads_press = -1 - else: - self.last_mads_press = now + self.CS.madsEnabled = not self.CS.madsEnabled self.CS.madsEnabled = self.get_acc_mads(ret.cruiseState.enabled, self.CS.accEnabled, self.CS.madsEnabled) self.CS.madsEnabled = False if self.CS.hands_on_level >= 3 else self.CS.madsEnabled diff --git a/selfdrive/car/tesla/values.py b/selfdrive/car/tesla/values.py index 891146a30df42e..0a222fe40babb4 100644 --- a/selfdrive/car/tesla/values.py +++ b/selfdrive/car/tesla/values.py @@ -66,7 +66,7 @@ class CANBUS: Button(car.CarState.ButtonEvent.Type.decelCruise, "VCLEFT_switchStatus", "VCLEFT_swcRightScrollTicks", list(range(-9, 0)), None), Button(car.CarState.ButtonEvent.Type.cancel, "SCCM_rightStalk", "SCCM_rightStalkStatus", [1, 2], None), Button(car.CarState.ButtonEvent.Type.resumeCruise, "SCCM_rightStalk", "SCCM_rightStalkStatus", [3, 4], None), - Button(car.CarState.ButtonEvent.Type.altButton2, "VCLEFT_switchStatus", "VCLEFT_swcRightPressed", [2], 1), # Note that mux needs to be handled in carState + Button(car.CarState.ButtonEvent.Type.altButton2, "VCLEFT_switchStatus", "VCLEFT_swcRightDoublePress", [1], 1), # Note that mux needs to be handled in carState Button(car.CarState.ButtonEvent.Type.gapAdjustCruise, "VCLEFT_switchStatus", "VCLEFT_swcRightTiltRight", [2], 1), # TODO: directional gap adjustment ]