Merge pull request #796 from keyboardio/idleleds/disable-on-0

IdleLEDs: Allow temporarily disabling the functionality
pull/805/head
Jesse Vincent 5 years ago committed by GitHub
commit 58bd7ec8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
@ -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

@ -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();

Loading…
Cancel
Save