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

Loading…
Cancel
Save