You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix instant execution of main action on holding
* simplify holdMode callback handling
* Update test_SimpleButton.py
* update docs
* fix: only go into while loop if further held
* docs: update comments
* docs: add alert for behavior change
* docs: fix typo
However, a button has more parameters than these. In the following comprehensive list you can also find the default values which are used automatically if you leave out these settings:
60
60
61
61
***functionCallArgs**: Arguments for primary function, defaults to `None`. Arguments are ignored, if `functionCall` does not take any.
62
+
63
+
> [!IMPORTANT]
64
+
> Since v2.8.0 the behavior of `hold_mode``SecondFunc` and `SecondFuncRepeat` has changed. The secondary function is no longer triggered additionally to the primary function.
65
+
> Now its called exclusively if `hold_time` is reached. The primary function will only be triggered if the button is pressed shorter then `hold_time`!
66
+
> Existing configurations may need to adapt to this.
62
67
***hold_mode**: Specifies what shall happen if the button is held pressed for longer than `hold_time`:
63
68
*`None` (Default): Nothing special will happen.
64
-
*`Repeat`: The configured `functionCall` is repeated after each `hold_time` interval.
69
+
*`Repeat`: The configured `functionCall` is instantly called and repeatedly after each `hold_time` interval.
65
70
*`Postpone`: The function will not be called before `hold_time`, i.e. the button needs to be pressed this long to activate the function
66
-
*`SecondFunc`: Holding the button for at least `hold_time` will additionally execute the function `functionCall2` with `functionCall2Args`.
71
+
*`SecondFunc`: Pressing the button (shorter than `hold_time`) will execute the function `functionCall` with `functionCallArgs`. Holding the button for at least `hold_time` will execute the function `functionCall2` with `functionCall2Args`.
67
72
*`SecondFuncRepeat`: Like SecondFunc, but `functionCall2` is repeated after each `hold_time` interval.
68
73
69
-
In every `hold_mode` except `Postpone`, the main action `functionCall` gets executed instantly.
70
-
71
74
Holding the button even longer than `hold_time` will cause no further action unless you are in the `Repeat` or `SecondFuncRepeat` mode.
72
75
73
76
***hold_time**: Reference time for this buttons `hold_mode` feature in seconds. Default is `0.3`. This setting is ignored if `hold_mode` is unset or `None`
@@ -79,10 +82,10 @@ However, a button has more parameters than these. In the following comprehensive
79
82
*`pull_off`. Use this to deactivate internal pull-up/pulldown resistors. This is useful if your wiring includes your own (external) pull up / down resistors.
80
83
***edge**: Configures the events in which the GPIO library shall trigger the callback function. Valid settings:
81
84
*`falling` (Default). Triggers if the GPIO voltage goes down.
82
-
*`rising`. Trigegrs only if the GPIO voltage goes up.
85
+
*`rising`. Triggers only if the GPIO voltage goes up.
83
86
*`both`. Triggers in both cases.
84
87
***bouncetime**: This is a setting of the GPIO library to limit bouncing effects during button usage. Default is `500` ms.
85
-
***antibouncehack**: Despite the integrated bounce reduction of the GPIO library some users may notice false triggers of their buttons (e.g. unrequested / double actions when releasing the button). If you encounter such problems, try setting this setting to `True` to activate an additional countermeasure.
88
+
***antibouncehack**: Despite the integrated bounce reduction of the GPIO library some users may notice false triggers of their buttons (e.g. unrequested / double actions when releasing the button). If you encounter such problems, try setting this to `True` to activate an additional countermeasure.
86
89
87
90
Note: If you prefer, you may also use `Type: SimpleButton` instead of `Type: Button` - this makes no difference.
0 commit comments