Browse Source

Added relay and color commands to terminal

fastled
Xose Pérez 7 years ago
parent
commit
0796b0f335
1 changed files with 28 additions and 0 deletions
  1. +28
    -0
      code/espurna/settings.ino

+ 28
- 0
code/espurna/settings.ino View File

@ -109,6 +109,34 @@ void settingsSetup() {
e->response(Embedis::OK); e->response(Embedis::OK);
}); });
Embedis::command( F("RELAY"), [](Embedis* e) {
if (e->argc < 2) {
return e->response(Embedis::ARGS_ERROR);
}
int id = String(e->argv[1]).toInt();
if (e->argc > 2) {
int value = String(e->argv[2]).toInt();
if (value == 2) {
relayToggle(id);
} else {
relayStatus(id, value == 1);
}
}
e->stream->printf("Status: %s\n", relayStatus(id) ? "true" : "false");
e->response(Embedis::OK);
});
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
Embedis::command( F("COLOR"), [](Embedis* e) {
if (e->argc > 1) {
String color = String(e->argv[1]);
lightColor(color.c_str(), true, true);
}
e->stream->printf("Color: %s\n", lightColor().c_str());
e->response(Embedis::OK);
});
#endif
Embedis::command( F("EEPROM"), [](Embedis* e) { Embedis::command( F("EEPROM"), [](Embedis* e) {
unsigned long freeEEPROM = SPI_FLASH_SEC_SIZE - settingsSize(); unsigned long freeEEPROM = SPI_FLASH_SEC_SIZE - settingsSize();
e->stream->printf("Number of keys: %d\n", settingsKeyCount()); e->stream->printf("Number of keys: %d\n", settingsKeyCount());


Loading…
Cancel
Save