Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed May 6, 2024
1 parent 867b923 commit 8f141bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions components/gpio_control/GPIODevices/simple_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down
5 changes: 2 additions & 3 deletions components/gpio_control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 8f141bc

Please sign in to comment.