From 28a7603315e27f89aa7082c07ddc71932164dc18 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 10 Nov 2022 23:37:08 -0800 Subject: [PATCH] comment --- selfdrive/car/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index 4684dd41e9..08f73ad299 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -23,12 +23,12 @@ def apply_hysteresis(val: float, val_steady: float, hyst_gap: float) -> float: def create_button_events(cur_button: int, prev_button: int, buttons_dict: Dict[int, capnp.lib.capnp._EnumModule], unpressed: int = 0, init: Optional[int] = None) -> List[capnp.lib.capnp._DynamicStructBuilder]: - events = [] # initializing, don't add any events - # TODO: if it's possible to go from init to NOT unpressed, we want to check that as well - if (init is not None and prev_button == init) or cur_button == prev_button: + events = [] + if init is not None and prev_button == init and cur_button == unpressed: return events + # Handle transitions between buttons without going to the unpressed value if cur_button != prev_button: for pressed, btn in ((False, prev_button), (True, cur_button)): if btn == unpressed: