diff --git a/esp8266_deauther/SerialInterface.cpp b/esp8266_deauther/SerialInterface.cpp index 4dbaa3a..1bd8e1c 100644 --- a/esp8266_deauther/SerialInterface.cpp +++ b/esp8266_deauther/SerialInterface.cpp @@ -657,7 +657,9 @@ void SerialInterface::runCommand(String input) { // ===== STOP ===== // // stop [] else if (eqlsCMD(0, CLI_STOP)) { + #ifdef DIGITAL_LED led.setMode(LED_MODE_IDLE, true); + #endif if (list->size() >= 2 && !(eqlsCMD(1, CLI_ALL))) { for (int i = 1; i < list->size(); i++) { if (eqlsCMD(i, CLI_SCAN)) scan.stop(); @@ -930,30 +932,45 @@ void SerialInterface::runCommand(String input) { // ===== LED ===== // // led [] else if (list->size() >= 4 && list->size() <= 5 && eqlsCMD(0, CLI_LED)) { - if (list->size() == 4) + if (list->size() == 4) { + #ifdef DIGITAL_LED led.setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt()); - else + #endif + } else { + #ifdef DIGITAL_LED led.setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt(), list->get(4).toInt()); + #endif + } } // led <#rrggbb> [] else if (list->size() >= 2 && list->size() <= 3 && eqlsCMD(0, CLI_LED) && list->get(1).charAt(0) == HASHSIGN) { uint8_t c[3]; strToColor(list->get(1), c); - if (list->size() == 2) + if (list->size() == 2) { + #ifdef DIGITAL_LED led.setColor(c[0], c[1], c[2]); - else + #endif + } else { + #ifdef DIGITAL_LED led.setColor(c[0], c[1], c[2], list->get(2).toInt()); + #endif + } } // led else if (list->size() == 2 && eqlsCMD(0, CLI_LED)) { - if (eqlsCMD(1, CLI_ENABLE)) + if (eqlsCMD(1, CLI_ENABLE)) { + #ifdef DIGITAL_LED led.tempEnable(); - else if (eqlsCMD(1, CLI_DISABLE)) + #endif + } else if (eqlsCMD(1, CLI_DISABLE)) { + #ifdef DIGITAL_LED led.tempDisable(); - else + #endif + } else { parameterError(list->get(1)); + } } @@ -968,7 +985,9 @@ void SerialInterface::runCommand(String input) { scan.update(); // run scan attack.update(); // run attacks ssids.update(); // run random mode, if enabled + #ifdef DIGITAL_LED led.update(); // update LED color + #endif // auto-save if (settings.getAutosave() && currentTime - autosaveTime > settings.getAutosaveTime()) { @@ -1121,4 +1140,4 @@ void SerialInterface::runCommand(String input) { } } - + diff --git a/esp8266_deauther/esp8266_deauther.ino b/esp8266_deauther/esp8266_deauther.ino index 5d3d940..6ef3a83 100644 --- a/esp8266_deauther/esp8266_deauther.ino +++ b/esp8266_deauther/esp8266_deauther.ino @@ -120,7 +120,9 @@ void setup() { scan.setup(); // set LED + #ifdef DIGITAL_LED led.setup(); + #endif // set channel setWifiChannel(settings.getChannel()); @@ -157,7 +159,9 @@ void loop() { serialInterface.update(); // read and run serial input scan.update(); // run scan ssids.update(); // run random mode, if enabled + #ifdef DIGITAL_LED led.update(); // update LED color + #endif // auto-save if (settings.getAutosave() && currentTime - autosaveTime > settings.getAutosaveTime()) { @@ -178,4 +182,4 @@ void loop() { - +