mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-23 15:10:06 +01:00
Added display on/off button
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#define upBtn 12 //GPIO 12 = D6
|
||||
#define downBtn 13 //GPIO 13 = D7
|
||||
#define selectBtn 14 //GPIO 14 = D5
|
||||
#define displayBtn 0 //GPIO 0 = FLASH BUTTON
|
||||
|
||||
#define buttonDelay 180 //delay in ms
|
||||
|
||||
@@ -44,6 +45,7 @@
|
||||
|
||||
bool canBtnPress = true;
|
||||
int buttonPressed = 0; //0 = UP, 1 = DOWN, 2 = SELECT, 3 = DISPLAY
|
||||
bool displayOn = true;
|
||||
#endif
|
||||
|
||||
String wifiMode = "";
|
||||
@@ -85,6 +87,7 @@ void sniffer(uint8_t *buf, uint16_t len) {
|
||||
|
||||
#ifdef USE_DISPLAY
|
||||
void drawInterface() {
|
||||
if(displayOn){
|
||||
display.clear();
|
||||
|
||||
int _lrow = 0;
|
||||
@@ -105,6 +108,7 @@ void drawInterface() {
|
||||
|
||||
display.display();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void startWifi() {
|
||||
@@ -449,6 +453,7 @@ void setup() {
|
||||
pinMode(upBtn, INPUT_PULLUP);
|
||||
pinMode(downBtn, INPUT_PULLUP);
|
||||
pinMode(selectBtn, INPUT_PULLUP);
|
||||
pinMode(displayBtn, INPUT_PULLUP);
|
||||
#endif
|
||||
|
||||
attackMode = "START";
|
||||
@@ -544,11 +549,12 @@ void loop() {
|
||||
|
||||
#ifdef USE_DISPLAY
|
||||
|
||||
if (digitalRead(upBtn) == LOW || digitalRead(downBtn) == LOW || digitalRead(selectBtn) == LOW){
|
||||
if (digitalRead(upBtn) == LOW || digitalRead(downBtn) == LOW || digitalRead(selectBtn) == LOW || digitalRead(displayBtn) == LOW){
|
||||
if(canBtnPress){
|
||||
if(digitalRead(upBtn) == LOW) buttonPressed = 0;
|
||||
else if(digitalRead(downBtn) == LOW) buttonPressed = 1;
|
||||
else if(digitalRead(selectBtn) == LOW) buttonPressed = 2;
|
||||
else if(digitalRead(displayBtn) == LOW) buttonPressed = 3;
|
||||
canBtnPress = false;
|
||||
}
|
||||
}else if(!canBtnPress){
|
||||
@@ -594,6 +600,12 @@ void loop() {
|
||||
apScan.select(curRow - 3);
|
||||
}
|
||||
}
|
||||
else if (buttonPressed == 3) {
|
||||
displayOn = !displayOn;
|
||||
display.clear();
|
||||
display.display();
|
||||
Serial.println("BUTTON PRESSED!");
|
||||
}
|
||||
}
|
||||
drawInterface();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user