pull/26463/head
Shane Smiskol 3 years ago
parent ad2c74a402
commit 28a7603315
  1. 6
      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:

Loading…
Cancel
Save