diff --git a/code/espurna/light.ino b/code/espurna/light.ino index 3d055385..d3db6adf 100644 --- a/code/espurna/light.ino +++ b/code/espurna/light.ino @@ -989,8 +989,15 @@ void _lightInitCommands() { terminalRegisterCommand(F("BRIGHTNESS"), [](Embedis* e) { if (e->argc > 1) { - lightBrightness(String(e->argv[1]).toInt()); - lightUpdate(true, true); + const String value(e->argv[1]); + if( value.length() > 0 ) { + if( value[0] == '+' || value[0] == '-' ) { + lightBrightness(lightBrightness()+String(e->argv[1]).toInt()); + } else { + lightBrightness(String(e->argv[1]).toInt()); + } + lightUpdate(true, true); + } } DEBUG_MSG_P(PSTR("Brightness: %d\n"), lightBrightness()); terminalOK(); @@ -1032,9 +1039,17 @@ void _lightInitCommands() { terminalRegisterCommand(F("MIRED"), [](Embedis* e) { if (e->argc > 1) { - String color = String("M") + String(e->argv[1]); - lightColor(color.c_str()); - lightUpdate(true, true); + const String value(e->argv[1]); + String color = String("M"); + if( value.length() > 0 ) { + if( value[0] == '+' || value[0] == '-' ) { + color += String(_light_mireds + String(e->argv[1]).toInt()); + } else { + color += String(e->argv[1]); + } + lightColor(color.c_str()); + lightUpdate(true, true); + } } DEBUG_MSG_P(PSTR("Color: %s\n"), lightColor().c_str()); terminalOK();