LEDControl: Expose brightness settings via Focus

When using the `FocusLEDCommand` plugin, expose brightness control too.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/792/head
Gergely Nagy 5 years ago
parent 947851150d
commit 5c49efcd79
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -189,6 +189,7 @@ EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) {
MODE,
AT,
THEME,
BRIGHTNESS,
} subCommand;
if (!Runtime.has_leds)
@ -197,6 +198,7 @@ EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) {
if (::Focus.handleHelp(command, PSTR("led.at\n"
"led.setAll\n"
"led.mode\n"
"led.brightness\n"
"led.theme")))
return EventHandlerResult::OK;
@ -210,6 +212,8 @@ EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) {
subCommand = MODE;
else if (strcmp_P(command + 4, PSTR("theme")) == 0)
subCommand = THEME;
else if (strcmp_P(command + 4, PSTR("brightness")) == 0)
subCommand = BRIGHTNESS;
else
return EventHandlerResult::OK;
@ -232,6 +236,16 @@ EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) {
}
break;
}
case BRIGHTNESS: {
if (::Focus.isEOL()) {
::Focus.send(::LEDControl.getBrightness());
} else {
uint8_t brightness;
::Focus.read(brightness);
::LEDControl.setBrightness(brightness);
}
}
case SETALL: {
cRGB c;

Loading…
Cancel
Save