mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-22 23:26:49 -08:00
Dynamic ledPin switching
This commit is contained in:
@@ -26,6 +26,21 @@ void Settings::syncMacInterface(){
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setLedPin(int newLedPin){
|
||||
prevLedPin = ledPin;
|
||||
if(newLedPin > 0 && newLedPin != prevLedPin){
|
||||
ledPin = newLedPin;
|
||||
pinMode(ledPin, OUTPUT);
|
||||
if(!prevLedPin == 0){
|
||||
digitalWrite(ledPin, digitalRead(prevLedPin));
|
||||
digitalWrite(prevLedPin, pinStateOff);
|
||||
pinMode(prevLedPin, INPUT);
|
||||
}else{
|
||||
digitalWrite(ledPin, pinStateOff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::load() {
|
||||
|
||||
if (EEPROM.read(checkNumAdr) != checkNum) {
|
||||
@@ -72,7 +87,7 @@ void Settings::load() {
|
||||
multiAttacks = (bool)EEPROM.read(multiAttacksAdr);
|
||||
macInterval = eepromReadInt(macIntervalAdr);
|
||||
beaconInterval = (bool)EEPROM.read(beaconIntervalAdr);
|
||||
ledPin = (int)EEPROM.read(ledPinAdr);
|
||||
setLedPin((int)EEPROM.read(ledPinAdr));
|
||||
isSettingsLoaded = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user