This repository was archived by the owner on May 14, 2026. It is now read-only.
Add delayed-off support for authbox outputs.#61
Open
brianbeck-google wants to merge 2 commits into
Open
Conversation
* Update the makefile to run them against all python files. * Fix syntax error in requirements_dev.txt (trailing period). * Update flake8 to v5. * Fix broken imports in unit tests * Run `make format` to get all files into a lint-clean state in preparation for future work. * Fix errors called out by `make lint` Fixes google#59 Tested: ``` make setup python -m unittest make format make lint ```
Author
|
This PR is significantly easier to review if diffed against a version of the codebase with the Linter run: As such I encourage reviewing and merging #60 prior to reviewing this change. |
This allows each output pin to have a configured delay between the abort
button being pressed and the pin being disabled. This supports scenarios
such as keeping ventilation on longer after a tool has been deactivated.
Tested:
* Added unit tests for delayed off and reauth during delay timer. All
tests pass
* Physical hardware: confirmed that previous config file (with no
changes, no delay section) continues working as before (all outputs
immediately turn off)
* Physical hardware: confirmed that outputs stay on during delay and
turn off after delay (tested delays 10s, 180s)
* Physical hardware: confirmed that deauth and then reauth during the
delay timer period leaves the device continuously on with no
interruption
This commit was generated in part with Gemini 3.1 Pro. Prompt:
```
Write a plan to add the ability to control the two outputs separately,
specifically keeping one output alive for a configurable duration after
the "off" behavior is triggered.
In two_button.ini the parameter `enable_output` currently toggles both
`Relay:ActiveHigh:29` and `Relay:ActiveHigh:31`. The logic to read
these parameters is in two_button.py
It is critical that all changes be backwards compatible - that is, after
the change, the old version of the config should trigger the same
behavior as today (trigger both outputs out and on at the same time).
There should be new syntax options that allow using this new behavior.
The code should handle the case where someone triggers an `abort` and
then triggers an `on_button_down` before the timer expires. In this
case, the output should remain continuously on.
* Add a new optional parameter for how long to keep Relay:ActiveHigh:31
after the service is disabled. This duration should be specified in
seconds.
* In the `abort` function in two_button.py, instead of immediately
turning all options off, if a delay >0 is configured, a timer should
be started. When the timer expires that output should be disabled
```
28729e7 to
779bb18
Compare
brianbeck-google
commented
Apr 1, 2026
Author
There was a problem hiding this comment.
Code review discussion: I'm open to feedback on the defaults in two_button.ini here:
- We could default both to 0 and require people to explicitly choose to enable a delay
- In the KIR makerspace, for the BoFA scenario I set it to 180 (3 minutes) which seems reasonable
- As written it's one minute, which is better than nothing but maybe not enough time to effectively filter air
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows each output pin to have a configured delay between the abort button being pressed and the pin being disabled. This supports scenarios such as keeping ventilation on longer after a tool has been deactivated.
Tested:
This commit was generated in part with Gemini 3.1 Pro. Prompt: