Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdleLEDs: Allow temporarily disabling the functionality #796

Merged
merged 1 commit into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/plugins/IdleLEDs.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ the following properties and methods.

> Sets the amount of time (in seconds) that can pass without a single key being
> pressed before the plugin considers the keyboard idle and turns off the LEDs.
>
> Setting the timeout to 0 will disable the plugin until it is set to a higher
> value.

## Focus commands

Expand All @@ -99,6 +102,9 @@ the `PersistentIdleLEDs` variant:

> Sets the idle time limit to `seconds`, when called with an argument. Returns
> the current limit (in seconds) when called without any.
>
> Setting the timeout to 0 will disable the plugin until it is set to a higher
> value.

## Dependencies

Expand Down
3 changes: 3 additions & 0 deletions src/kaleidoscope/plugin/IdleLEDs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ void IdleLEDs::setIdleTimeoutSeconds(uint32_t new_limit) {
}

EventHandlerResult IdleLEDs::beforeEachCycle() {
if (idle_time_limit == 0)
return EventHandlerResult::OK;

if (::LEDControl.isEnabled() &&
Runtime.hasTimeExpired(start_time_, idle_time_limit)) {
::LEDControl.disable();
Expand Down