Skip to content

Commit 0270af5

Browse files
committed
pushbutton.py: Fix iss 101.
1 parent 44de299 commit 0270af5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

v3/primitives/pushbutton.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pushbutton.py
22

3-
# Copyright (c) 2018-2022 Peter Hinch
3+
# Copyright (c) 2018-2023 Peter Hinch
44
# Released under the MIT License (MIT) - see LICENSE file
55

66
import uasyncio as asyncio
@@ -48,7 +48,9 @@ def _check(self, state):
4848
if state: # Button pressed: launch pressed func
4949
if self._tf:
5050
launch(self._tf, self._ta)
51-
if self._ld: # There's a long func: start long press delay
51+
# If there's a long func: start long press delay if no double click running
52+
# (case where a short click is rapidly followed by a long one, iss 101).
53+
if self._ld and not (self._df and self._dd()):
5254
self._ld.trigger(Pushbutton.long_press_ms)
5355
if self._df:
5456
if self._dd(): # Second click: timer running

0 commit comments

Comments
 (0)