[ion/bench] Clean Led command

This commit is contained in:
Léa Saviot
2019-04-09 15:26:06 +02:00
parent 9b6c6e9092
commit f71241f16f

View File

@@ -11,22 +11,22 @@ namespace Command {
void LED(const char * input) {
if (strcmp(input, sON) == 0) {
Ion::Device::LED::init();
Ion::Console::writeLine(sOK);
reply(sOK);
return;
}
if (strcmp(input, sOFF) == 0) {
Ion::Device::LED::shutdown();
Ion::Console::writeLine(sOK);
reply(sOK);
return;
}
if (input == nullptr || input[0] != '0' || input[1] != 'x' || !isHex(input[2]) ||!isHex(input[3]) || !isHex(input[4]) || !isHex(input[5]) || !isHex(input[6]) || !isHex(input[7]) || input[8] != NULL) {
Ion::Console::writeLine(sSyntaxError);
reply(sSyntaxError);
return;
}
uint32_t hexColor = hexNumber(input+2);
KDColor ledColor = KDColor::RGB24(hexColor);
Ion::LED::setColor(ledColor);
Ion::Console::writeLine(sOK);
reply(sOK);
}
}