From 8f141bc7102ebb0397b5f8c9a37fdfa11a33dcea Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 5 May 2024 23:27:51 +0200 Subject: [PATCH] update docs --- components/gpio_control/GPIODevices/simple_button.py | 3 +-- components/gpio_control/README.md | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/gpio_control/GPIODevices/simple_button.py b/components/gpio_control/GPIODevices/simple_button.py index 3055a15a5..087329ede 100644 --- a/components/gpio_control/GPIODevices/simple_button.py +++ b/components/gpio_control/GPIODevices/simple_button.py @@ -135,7 +135,6 @@ def set_callbackFunction(self, callbackFunction): def _handleCallbackFunction(self, *args): logger.info('{}: handleCallbackFunction, mode: {}'.format(self.name, self.hold_mode)) - # action(s) after hold_time if self.hold_mode == "Repeat": # Repeated call of main action (instantly and multiple times if button is held long enough) self.when_pressed(*args) @@ -169,7 +168,7 @@ def _handleCallbackFunction(self, *args): while checkGpioStaysInState(self.hold_time, self.pin, GPIO.LOW): self.when_held(*args) - else: + else: self.when_pressed(*args) def __del__(self): diff --git a/components/gpio_control/README.md b/components/gpio_control/README.md index bae060400..73bbbb830 100644 --- a/components/gpio_control/README.md +++ b/components/gpio_control/README.md @@ -61,12 +61,11 @@ However, a button has more parameters than these. In the following comprehensive * **functionCallArgs**: Arguments for primary function, defaults to `None`. Arguments are ignored, if `functionCall` does not take any. * **hold_mode**: Specifies what shall happen if the button is held pressed for longer than `hold_time`: * `None` (Default): Nothing special will happen. - * `Repeat`: The configured `functionCall` is repeated after each `hold_time` interval. + * `Repeat`: The configured `functionCall` is instantly called and repeatedly after each `hold_time` interval. * `Postpone`: The function will not be called before `hold_time`, i.e. the button needs to be pressed this long to activate the function - * `SecondFunc`: Holding the button for at least `hold_time` will additionally execute the function `functionCall2` with `functionCall2Args`. + * `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`. * `SecondFuncRepeat`: Like SecondFunc, but `functionCall2` is repeated after each `hold_time` interval. - In every `hold_mode` except `Postpone`, the main action `functionCall` gets executed instantly. Holding the button even longer than `hold_time` will cause no further action unless you are in the `Repeat` or `SecondFuncRepeat` mode.