Skip to content

Commit d438450

Browse files
committed
DIGITAL_LED can now be turned off by config
1 parent 8daf8cc commit d438450

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

esp8266_deauther/SerialInterface.cpp

+27-8
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,9 @@ void SerialInterface::runCommand(String input) {
657657
// ===== STOP ===== //
658658
// stop [<mode>]
659659
else if (eqlsCMD(0, CLI_STOP)) {
660+
#ifdef DIGITAL_LED
660661
led.setMode(LED_MODE_IDLE, true);
662+
#endif
661663
if (list->size() >= 2 && !(eqlsCMD(1, CLI_ALL))) {
662664
for (int i = 1; i < list->size(); i++) {
663665
if (eqlsCMD(i, CLI_SCAN)) scan.stop();
@@ -930,30 +932,45 @@ void SerialInterface::runCommand(String input) {
930932
// ===== LED ===== //
931933
// led <r> <g> <b> [<brightness>]
932934
else if (list->size() >= 4 && list->size() <= 5 && eqlsCMD(0, CLI_LED)) {
933-
if (list->size() == 4)
935+
if (list->size() == 4) {
936+
#ifdef DIGITAL_LED
934937
led.setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt());
935-
else
938+
#endif
939+
} else {
940+
#ifdef DIGITAL_LED
936941
led.setColor(list->get(1).toInt(), list->get(2).toInt(), list->get(3).toInt(), list->get(4).toInt());
942+
#endif
943+
}
937944
}
938945

939946
// led <#rrggbb> [<brightness>]
940947
else if (list->size() >= 2 && list->size() <= 3 && eqlsCMD(0, CLI_LED) && list->get(1).charAt(0) == HASHSIGN) {
941948
uint8_t c[3];
942949
strToColor(list->get(1), c);
943-
if (list->size() == 2)
950+
if (list->size() == 2) {
951+
#ifdef DIGITAL_LED
944952
led.setColor(c[0], c[1], c[2]);
945-
else
953+
#endif
954+
} else {
955+
#ifdef DIGITAL_LED
946956
led.setColor(c[0], c[1], c[2], list->get(2).toInt());
957+
#endif
958+
}
947959
}
948960

949961
// led <enable/disable>
950962
else if (list->size() == 2 && eqlsCMD(0, CLI_LED)) {
951-
if (eqlsCMD(1, CLI_ENABLE))
963+
if (eqlsCMD(1, CLI_ENABLE)) {
964+
#ifdef DIGITAL_LED
952965
led.tempEnable();
953-
else if (eqlsCMD(1, CLI_DISABLE))
966+
#endif
967+
} else if (eqlsCMD(1, CLI_DISABLE)) {
968+
#ifdef DIGITAL_LED
954969
led.tempDisable();
955-
else
970+
#endif
971+
} else {
956972
parameterError(list->get(1));
973+
}
957974

958975
}
959976

@@ -968,7 +985,9 @@ void SerialInterface::runCommand(String input) {
968985
scan.update(); // run scan
969986
attack.update(); // run attacks
970987
ssids.update(); // run random mode, if enabled
988+
#ifdef DIGITAL_LED
971989
led.update(); // update LED color
990+
#endif
972991

973992
// auto-save
974993
if (settings.getAutosave() && currentTime - autosaveTime > settings.getAutosaveTime()) {
@@ -1121,4 +1140,4 @@ void SerialInterface::runCommand(String input) {
11211140
}
11221141
}
11231142

1124-
1143+

esp8266_deauther/esp8266_deauther.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ void setup() {
120120
scan.setup();
121121

122122
// set LED
123+
#ifdef DIGITAL_LED
123124
led.setup();
125+
#endif
124126

125127
// set channel
126128
setWifiChannel(settings.getChannel());
@@ -157,7 +159,9 @@ void loop() {
157159
serialInterface.update(); // read and run serial input
158160
scan.update(); // run scan
159161
ssids.update(); // run random mode, if enabled
162+
#ifdef DIGITAL_LED
160163
led.update(); // update LED color
164+
#endif
161165

162166
// auto-save
163167
if (settings.getAutosave() && currentTime - autosaveTime > settings.getAutosaveTime()) {
@@ -178,4 +182,4 @@ void loop() {
178182

179183

180184

181-
185+

0 commit comments

Comments
 (0)