Merge pull request #792 from keyboardio/ledcontrol/brightness-focus

LEDControl: Expose brightness settings via Focus
pull/796/head
Gergely Nagy 5 years ago committed by GitHub
commit d0bde7e00b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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