Cleaned up display class & fixed timeout

This commit is contained in:
Stefan Kremser
2018-10-12 21:07:59 +02:00
parent 7610db9534
commit 763bff53d4
5 changed files with 1418 additions and 1421 deletions

View File

@@ -1137,10 +1137,10 @@ void CLI::runCommand(String input) {
// ===== SCREEN ===== // // ===== SCREEN ===== //
// screen mode <menu/packetmonitor/buttontest/loading> // screen mode <menu/packetmonitor/buttontest/loading>
else if (eqlsCMD(0, CLI_SCREEN) && eqlsCMD(1, CLI_MODE)) { else if (eqlsCMD(0, CLI_SCREEN) && eqlsCMD(1, CLI_MODE)) {
if (eqlsCMD(2, CLI_MODE_BUTTONTEST)) displayUI.mode = SCREEN_MODE_BUTTON_TEST; if (eqlsCMD(2, CLI_MODE_BUTTONTEST)) displayUI.mode = displayUI.DISPLAY_MODE::BUTTON_TEST;
else if (eqlsCMD(2, CLI_MODE_PACKETMONITOR)) displayUI.mode = SCREEN_MODE_PACKETMONITOR; else if (eqlsCMD(2, CLI_MODE_PACKETMONITOR)) displayUI.mode = displayUI.DISPLAY_MODE::PACKETMONITOR;
else if (eqlsCMD(2, CLI_MODE_LOADINGSCREEN)) displayUI.mode = SCREEN_MODE_LOADSCAN; else if (eqlsCMD(2, CLI_MODE_LOADINGSCREEN)) displayUI.mode = displayUI.DISPLAY_MODE::LOADSCAN;
else if (eqlsCMD(2, CLI_MODE_MENU)) displayUI.mode = SCREEN_MODE_MENU; else if (eqlsCMD(2, CLI_MODE_MENU)) displayUI.mode = displayUI.DISPLAY_MODE::MENU;
else parameterError(list->get(2)); else parameterError(list->get(2));
prntln(CLI_CHANGED_SCREEN); prntln(CLI_CHANGED_SCREEN);
} }

View File

@@ -1,20 +1,5 @@
#include "DisplayUI.h" #include "DisplayUI.h"
DisplayUI::DisplayUI() {}
void DisplayUI::setupDisplay() {
configInit();
}
#ifdef HIGHLIGHT_LED
void DisplayUI::setupLED() {
pinMode(HIGHLIGHT_LED, OUTPUT);
digitalWrite(HIGHLIGHT_LED, HIGH);
highlightLED = true;
}
#endif
// ===== adjustable ===== // // ===== adjustable ===== //
void DisplayUI::configInit() { void DisplayUI::configInit() {
// initialize display // initialize display
@@ -65,137 +50,19 @@ void DisplayUI::drawString(int row, String str) {
void DisplayUI::drawLine(int x1, int y1, int x2, int y2) { void DisplayUI::drawLine(int x1, int y1, int x2, int y2) {
display.drawLine(x1, y1, x2, y2); display.drawLine(x1, y1, x2, y2);
} }
// ====================== // // ====================== //
void DisplayUI::on() {
if (enabled) {
configOn();
mode = SCREEN_MODE_MENU;
buttonTime = currentTime; // update a button time to keep display on
prntln(D_MSG_DISPLAY_ON);
} else {
prntln(D_ERROR_NOT_ENABLED);
}
}
void DisplayUI::off() { DisplayUI::DisplayUI() {}
if (enabled) {
configOff();
mode = SCREEN_MODE_OFF;
prntln(D_MSG_DISPLAY_OFF);
} else {
prntln(D_ERROR_NOT_ENABLED);
}
}
void DisplayUI::setupButtons() { DisplayUI::~DisplayUI() {}
up = new ButtonPullup(BUTTON_UP);
down = new ButtonPullup(BUTTON_DOWN);
a = new ButtonPullup(BUTTON_A);
b = new ButtonPullup(BUTTON_B);
// === BUTTON UP === //
up->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = millis();
if (mode == SCREEN_MODE_MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected > 0) currentMenu->selected--;
else currentMenu->selected = currentMenu->list->size() - 1;
} else if (mode == SCREEN_MODE_PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel + 1);
}
});
up->setOnHolding([this]() {
scrollCounter = 0;
buttonTime = millis();
if (mode == SCREEN_MODE_MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected > 0) currentMenu->selected--;
else currentMenu->selected = currentMenu->list->size() - 1;
} else if (mode == SCREEN_MODE_PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel + 1);
}
}, 250);
// === BUTTON DOWN === //
down->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = millis();
if (mode == SCREEN_MODE_MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected < currentMenu->list->size() - 1) currentMenu->selected++;
else currentMenu->selected = 0;
} else if (mode == SCREEN_MODE_PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel - 1);
}
});
down->setOnHolding([this]() {
scrollCounter = 0;
buttonTime = millis();
if (mode == SCREEN_MODE_MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected < currentMenu->list->size() - 1) currentMenu->selected++;
else currentMenu->selected = 0;
} else if (mode == SCREEN_MODE_PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel - 1);
}
}, 250);
// === BUTTON A === //
a->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = millis();
switch (mode) {
case SCREEN_MODE_MENU:
if (currentMenu->list->get(currentMenu->selected).click) {
currentMenu->list->get(currentMenu->selected).click();
}
break;
case SCREEN_MODE_PACKETMONITOR:
case SCREEN_MODE_LOADSCAN:
scan.stop();
mode = SCREEN_MODE_MENU;
break;
}
});
a->setOnHolding([this]() {
scrollCounter = 0;
buttonTime = millis();
if (currentMenu->list->get(currentMenu->selected).hold) {
currentMenu->list->get(currentMenu->selected).hold();
}
}, 800);
// === BUTTON B === //
a->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = millis();
switch (mode) {
case SCREEN_MODE_MENU:
goBack();
break;
case SCREEN_MODE_PACKETMONITOR:
case SCREEN_MODE_LOADSCAN:
scan.stop();
mode = SCREEN_MODE_MENU;
break;
}
});
}
void DisplayUI::setup() { void DisplayUI::setup() {
setupDisplay(); configInit();
setupButtons(); setupButtons();
buttonTime = currentTime;
// ===== MENUS ===== // // ===== MENUS ===== //
@@ -206,29 +73,29 @@ void DisplayUI::setup() {
addMenuNode(&mainMenu, D_ATTACK, &attackMenu); // ATTACK addMenuNode(&mainMenu, D_ATTACK, &attackMenu); // ATTACK
addMenuNode(&mainMenu, D_PACKET_MONITOR, [this]() { // PACKET MONITOR addMenuNode(&mainMenu, D_PACKET_MONITOR, [this]() { // PACKET MONITOR
scan.start(SCAN_MODE_SNIFFER, 0, SCAN_MODE_OFF, 0, false, wifi_channel); scan.start(SCAN_MODE_SNIFFER, 0, SCAN_MODE_OFF, 0, false, wifi_channel);
mode = SCREEN_MODE_PACKETMONITOR; mode = DISPLAY_MODE::PACKETMONITOR;
}); });
#ifdef HIGHLIGHT_LED #ifdef HIGHLIGHT_LED
addMenuNode(&mainMenu, D_LED, [this]() { // LED addMenuNode(&mainMenu, D_LED, [this]() { // LED
highlightLED = !highlightLED; highlightLED = !highlightLED;
digitalWrite(HIGHLIGHT_LED, highlightLED); digitalWrite(HIGHLIGHT_LED, highlightLED);
}); });
#endif #endif // ifdef HIGHLIGHT_LED
}); });
// SCAN MENU // SCAN MENU
createMenu(&scanMenu, &mainMenu, [this]() { createMenu(&scanMenu, &mainMenu, [this]() {
addMenuNode(&scanMenu, D_SCAN_APST, [this]() { // SCAN AP + ST addMenuNode(&scanMenu, D_SCAN_APST, [this]() { // SCAN AP + ST
scan.start(SCAN_MODE_ALL, 15000, SCAN_MODE_OFF, 0, true, wifi_channel); scan.start(SCAN_MODE_ALL, 15000, SCAN_MODE_OFF, 0, true, wifi_channel);
mode = SCREEN_MODE_LOADSCAN; mode = DISPLAY_MODE::LOADSCAN;
}); });
addMenuNode(&scanMenu, D_SCAN_AP, [this]() { // SCAN AP addMenuNode(&scanMenu, D_SCAN_AP, [this]() { // SCAN AP
scan.start(SCAN_MODE_APS, 0, SCAN_MODE_OFF, 0, true, wifi_channel); scan.start(SCAN_MODE_APS, 0, SCAN_MODE_OFF, 0, true, wifi_channel);
mode = SCREEN_MODE_LOADSCAN; mode = DISPLAY_MODE::LOADSCAN;
}); });
addMenuNode(&scanMenu, D_SCAN_ST, [this]() { // SCAN ST addMenuNode(&scanMenu, D_SCAN_ST, [this]() { // SCAN ST
scan.start(SCAN_MODE_STATIONS, 30000, SCAN_MODE_OFF, 0, true, wifi_channel); scan.start(SCAN_MODE_STATIONS, 30000, SCAN_MODE_OFF, 0, true, wifi_channel);
mode = SCREEN_MODE_LOADSCAN; mode = DISPLAY_MODE::LOADSCAN;
}); });
}); });
@@ -568,6 +435,15 @@ void DisplayUI::setup() {
startTime = currentTime; startTime = currentTime;
} }
#ifdef HIGHLIGHT_LED
void DisplayUI::setupLED() {
pinMode(HIGHLIGHT_LED, OUTPUT);
digitalWrite(HIGHLIGHT_LED, HIGH);
highlightLED = true;
}
#endif // ifdef HIGHLIGHT_LED
void DisplayUI::update() { void DisplayUI::update() {
if (!enabled) return; if (!enabled) return;
@@ -577,41 +453,187 @@ void DisplayUI::update() {
b->update(); b->update();
draw(); draw();
/*
uint32_t timeout = millis() - (settings.getDisplayTimeout() * 1000);
Serial.println(timeout);
if (mode != SCREEN_MODE_OFF && buttonTime < timeout) off(); uint32_t timeout = settings.getDisplayTimeout() * 1000;
else if (mode == SCREEN_MODE_OFF && buttonTime > timeout) on();*/
if (currentTime > timeout) {
if (!tempOff) {
if (buttonTime < currentTime - timeout) off();
} else {
if (buttonTime > currentTime - timeout) on();
}
}
}
void DisplayUI::on() {
if (enabled) {
configOn();
tempOff = false;
buttonTime = currentTime; // update a button time to keep display on
prntln(D_MSG_DISPLAY_ON);
} else {
prntln(D_ERROR_NOT_ENABLED);
}
}
void DisplayUI::off() {
if (enabled) {
configOff();
tempOff = true;
prntln(D_MSG_DISPLAY_OFF);
} else {
prntln(D_ERROR_NOT_ENABLED);
}
}
void DisplayUI::setupButtons() {
up = new ButtonPullup(BUTTON_UP);
down = new ButtonPullup(BUTTON_DOWN);
a = new ButtonPullup(BUTTON_A);
b = new ButtonPullup(BUTTON_B);
// === BUTTON UP === //
up->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected > 0) currentMenu->selected--;
else currentMenu->selected = currentMenu->list->size() - 1;
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel + 1);
}
}
});
up->setOnHolding([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected > 0) currentMenu->selected--;
else currentMenu->selected = currentMenu->list->size() - 1;
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel + 1);
}
}
}, buttonDelay);
// === BUTTON DOWN === //
down->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected < currentMenu->list->size() - 1) currentMenu->selected++;
else currentMenu->selected = 0;
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel - 1);
}
}
});
down->setOnHolding([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
if (mode == DISPLAY_MODE::MENU) { // when in menu, go up or down with cursor
if (currentMenu->selected < currentMenu->list->size() - 1) currentMenu->selected++;
else currentMenu->selected = 0;
} else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel
scan.setChannel(wifi_channel - 1);
}
}
}, buttonDelay);
// === BUTTON A === //
a->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
switch (mode) {
case DISPLAY_MODE::MENU:
if (currentMenu->list->get(currentMenu->selected).click) {
currentMenu->list->get(currentMenu->selected).click();
}
break;
case DISPLAY_MODE::PACKETMONITOR:
case DISPLAY_MODE::LOADSCAN:
scan.stop();
mode = DISPLAY_MODE::MENU;
break;
}
}
});
a->setOnHolding([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
if (mode == DISPLAY_MODE::MENU) {
if (currentMenu->list->get(currentMenu->selected).hold) {
currentMenu->list->get(currentMenu->selected).hold();
}
}
}
}, 800);
// === BUTTON B === //
a->setOnClicked([this]() {
scrollCounter = 0;
buttonTime = currentTime;
if (!tempOff) {
switch (mode) {
case DISPLAY_MODE::MENU:
goBack();
break;
case DISPLAY_MODE::PACKETMONITOR:
case DISPLAY_MODE::LOADSCAN:
scan.stop();
mode = DISPLAY_MODE::MENU;
break;
}
}
});
}
String DisplayUI::getChannel() {
String ch = String(wifi_channel);
if (ch.length() < 2) ch = ' ' + ch;
return ch;
} }
void DisplayUI::draw() { void DisplayUI::draw() {
if ((currentTime - drawTime > DRAW_INTERVAL) && currentMenu) { if ((currentTime - drawTime > drawInterval) && currentMenu) {
drawTime = currentTime; drawTime = currentTime;
updatePrefix(); updatePrefix();
switch (mode) { switch (mode) {
case SCREEN_MODE_BUTTON_TEST: case DISPLAY_MODE::BUTTON_TEST:
drawButtonTest(); drawButtonTest();
break; break;
case SCREEN_MODE_MENU: case DISPLAY_MODE::MENU:
drawMenu(); drawMenu();
break; break;
case SCREEN_MODE_LOADSCAN: case DISPLAY_MODE::LOADSCAN:
drawLoadingScan(); drawLoadingScan();
break; break;
case SCREEN_MODE_PACKETMONITOR: case DISPLAY_MODE::PACKETMONITOR:
drawPacketMonitor(); drawPacketMonitor();
break; break;
case SCREEN_MODE_INTRO: case DISPLAY_MODE::INTRO:
if (currentTime - startTime >= screenIntroTime) {
if (currentTime - startTime >= SCREEN_INTRO_TIME) { mode = DISPLAY_MODE::MENU;
mode = SCREEN_MODE_MENU;
} }
drawIntro(); drawIntro();
break; break;
@@ -622,18 +644,10 @@ void DisplayUI::draw() {
} }
void DisplayUI::drawButtonTest() { void DisplayUI::drawButtonTest() {
/* drawString(0, str(D_UP) + b2s(up->read()));
if (buttonUp.enabled) drawString(0, 0, str(D_UP) + b2s(buttonUp.pushed)); drawString(1, str(D_DOWN) + b2s(down->read()));
drawString(2, str(D_A) + b2s(a->read()));
if (buttonDown.enabled) drawString(0, 9, str(D_DOWN) + b2s(buttonDown.pushed)); drawString(3, str(D_B) + b2s(b->read()));
if (buttonLeft.enabled) drawString(0, 18, str(D_LEFT) + b2s(buttonLeft.pushed));
if (buttonRight.enabled) drawString(0, 27, str(D_RIGHT) + b2s(buttonRight.pushed));
if (buttonA.enabled) drawString(0, 36, str(D_A) + b2s(buttonA.pushed));
if (buttonB.enabled) drawString(0, 45, str(D_B) + b2s(buttonB.pushed));*/
} }
void DisplayUI::drawMenu() { void DisplayUI::drawMenu() {
@@ -652,10 +666,10 @@ void DisplayUI::drawMenu() {
// horizontal scrolling // horizontal scrolling
if ((currentMenu->selected == i) && (tmpLen > maxLen - 1)) { if ((currentMenu->selected == i) && (tmpLen > maxLen - 1)) {
tmp = tmp.substring(scrollCounter / SCROLL_SPEED); tmp = tmp.substring(scrollCounter / scrollSpeed);
scrollCounter++; scrollCounter++;
if (scrollCounter / SCROLL_SPEED > tmpLen - maxLen - 1) scrollCounter = 0; if (scrollCounter / scrollSpeed > tmpLen - maxLen - 1) scrollCounter = 0;
} }
tmp = (currentMenu->selected == i ? CURSOR : SPACE) + tmp; tmp = (currentMenu->selected == i ? CURSOR : SPACE) + tmp;
@@ -679,16 +693,11 @@ void DisplayUI::drawLoadingScan() {
drawString(4, center(percentage, maxLen)); drawString(4, center(percentage, maxLen));
} }
String DisplayUI::getChannel() {
String ch = String(wifi_channel);
if (ch.length() < 2) ch = ' ' + ch;
return ch;
}
void DisplayUI::drawPacketMonitor() { void DisplayUI::drawPacketMonitor() {
double scale = scan.getScaleFactor(50); double scale = scan.getScaleFactor(50);
String headline = leftRight(str(D_CH) + getChannel() + String(' ') + String('[') + String(scan.deauths) + String(']'), String(scan.getPacketRate()) + str(D_PKTS) , maxLen); String headline = leftRight(str(D_CH) + getChannel() + String(' ') + String('[') + String(scan.deauths) + String(']'), String(scan.getPacketRate()) + str(D_PKTS), maxLen);
drawString(0, 0, headline); drawString(0, 0, headline);
if (scan.getMaxPacket() > 0) { if (scan.getMaxPacket() > 0) {

View File

@@ -1,12 +1,6 @@
#ifndef DisplayUI_h #ifndef DisplayUI_h
#define DisplayUI_h #define DisplayUI_h
#include "Arduino.h"
#include <ESP8266WiFi.h>
#include <FS.h>
extern "C" {
#include "user_interface.h"
}
#include "language.h" #include "language.h"
#include "A_config.h" #include "A_config.h"
#include "Settings.h" #include "Settings.h"
@@ -35,37 +29,22 @@ extern String right(String a, int len);
extern String leftRight(String a, String b, int len); extern String leftRight(String a, String b, int len);
extern String replaceUtf8(String str, String r); extern String replaceUtf8(String str, String r);
// fallback for the buttons
#ifndef BUTTON_UP #ifndef BUTTON_UP
#define BUTTON_UP 255 #define BUTTON_UP 255
#endif #endif // ifndef BUTTON_UP
#ifndef BUTTON_DOWN #ifndef BUTTON_DOWN
#define BUTTON_DOWN 255 #define BUTTON_DOWN 255
#endif #endif // ifndef BUTTON_DOWN
#ifndef BUTTON_A #ifndef BUTTON_A
#define BUTTON_A 255 #define BUTTON_A 255
#endif #endif // ifndef BUTTON_A
#ifndef BUTTON_B #ifndef BUTTON_B
#define BUTTON_B 255 #define BUTTON_B 255
#endif #endif // ifndef BUTTON_B
// different display modes
#define SCREEN_MODE_OFF 0
#define SCREEN_MODE_BUTTON_TEST 1
#define SCREEN_MODE_MENU 2
#define SCREEN_MODE_LOADSCAN 3
#define SCREEN_MODE_PACKETMONITOR 4
#define SCREEN_MODE_INTRO 5
// ===== adjustable ===== //
#define BUTTON_DELAY 280 // in ms
#define DRAW_INTERVAL 100 // 100ms = 10 FPS
#define SCROLL_SPEED 5
#define SCREEN_INTRO_TIME 2500
// ====================== //
struct MenuNode { struct MenuNode {
std::function<String()>getStr; // function used to create the displayed string std::function<String()>getStr; // function used to create the displayed string
@@ -82,20 +61,26 @@ struct Menu {
class DisplayUI { class DisplayUI {
public: public:
enum DISPLAY_MODE { OFF = 0, BUTTON_TEST = 1, MENU = 2, LOADSCAN = 3, PACKETMONITOR = 4, INTRO = 5 };
uint8_t mode = DISPLAY_MODE::MENU;
bool highlightLED = false;
Button* up = NULL; Button* up = NULL;
Button* down = NULL; Button* down = NULL;
Button* a = NULL; Button* a = NULL;
Button* b = NULL; Button* b = NULL;
DisplayUI();
void setup();
#ifdef HIGHLIGHT_LED
void setupLED();
bool highlightLED = false;
#endif
// ===== adjustable ===== // // ===== adjustable ===== //
DEAUTHER_DISPLAY // see config.h
const uint8_t maxLen = 18;
const uint8_t lineHeight = 12;
const uint8_t scrollSpeed = 5;
const uint8_t buttonDelay = 250;
const uint8_t drawInterval = 100; // 100ms = 10 FPS
const uint16_t screenIntroTime = 2500;
void configInit(); void configInit();
void configOn(); void configOn();
void configOff(); void configOff();
@@ -104,58 +89,35 @@ class DisplayUI {
void drawString(int x, int y, String str); void drawString(int x, int y, String str);
void drawString(int row, String str); void drawString(int row, String str);
void drawLine(int x1, int y1, int x2, int y2); void drawLine(int x1, int y1, int x2, int y2);
DEAUTHER_DISPLAY // see config.h
uint8_t maxLen = 18;
uint8_t lineHeight = 12;
uint8_t scrollSpeed = 5;
// ====================== // // ====================== //
DisplayUI();
~DisplayUI();
void setup();
#ifdef HIGHLIGHT_LED
void setupLED();
#endif // ifdef HIGHLIGHT_LED
void update(); void update();
void on(); void on();
void off(); void off();
uint8_t mode = SCREEN_MODE_MENU;
private: private:
void setupDisplay();
void setupButtons();
int16_t selectedID = 0; // i.e. access point ID to draw the apMenu int16_t selectedID = 0; // i.e. access point ID to draw the apMenu
uint16_t scrollCounter = 0; // for horizontal scrolling uint16_t scrollCounter = 0; // for horizontal scrolling
uint32_t drawTime = 0; // last time a frame was drawn uint32_t drawTime = 0; // last time a frame was drawn
uint32_t startTime = 0; // when the screen was enabled uint32_t startTime = 0; // when the screen was enabled
uint32_t buttonTime = 0; // last time a button was pressed uint32_t buttonTime = 0; // last time a button was pressed
bool enabled = false; // display enabled bool enabled = false; // display enabled
bool tempOff = false;
// selected attack modes // selected attack modes
bool beaconSelected = false; bool beaconSelected = false;
bool deauthSelected = false; bool deauthSelected = false;
bool probeSelected = false; bool probeSelected = false;
String getChannel();
// draw functions
void draw();
void drawButtonTest();
void drawMenu();
void drawLoadingScan();
void drawPacketMonitor();
void drawIntro();
void clearMenu(Menu* menu);
// menu functions
void changeMenu(Menu* menu);
void goBack();
void createMenu(Menu* menu, Menu* parent, std::function<void()>build);
void addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click,
std::function<void()>hold);
void addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click);
void addMenuNode(Menu* menu, std::function<String()>getStr, Menu* next);
void addMenuNode(Menu* menu, const char* ptr, std::function<void()>click);
void addMenuNode(Menu* menu, const char* ptr, Menu* next);
// menus // menus
Menu* currentMenu; Menu* currentMenu;
@@ -174,6 +136,30 @@ class DisplayUI {
Menu stationMenu; Menu stationMenu;
Menu nameMenu; Menu nameMenu;
Menu ssidMenu; Menu ssidMenu;
void setupButtons();
String getChannel();
// draw functions
void draw();
void drawButtonTest();
void drawMenu();
void drawLoadingScan();
void drawPacketMonitor();
void drawIntro();
void clearMenu(Menu* menu);
// menu functions
void changeMenu(Menu* menu);
void goBack();
void createMenu(Menu* menu, Menu* parent, std::function<void()>build);
void addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click, std::function<void()>hold);
void addMenuNode(Menu* menu, std::function<String()>getStr, std::function<void()>click);
void addMenuNode(Menu* menu, std::function<String()>getStr, Menu* next);
void addMenuNode(Menu* menu, const char* ptr, std::function<void()>click);
void addMenuNode(Menu* menu, const char* ptr, Menu* next);
}; };
// ===== FONT ===== // // ===== FONT ===== //

View File

@@ -91,7 +91,7 @@ void setup() {
// start display // start display
if (settings.getDisplayInterface()) { if (settings.getDisplayInterface()) {
displayUI.setup(); displayUI.setup();
displayUI.mode = SCREEN_MODE_INTRO; displayUI.mode = displayUI.DISPLAY_MODE::INTRO;
} }
// copy web files to SPIFFS // copy web files to SPIFFS

View File

@@ -1,6 +1,8 @@
#ifndef language_h #ifndef language_h
#define language_h #define language_h
#include "Arduino.h"
extern String str(const char* ptr); extern String str(const char* ptr);
extern String keyword(const char* keywordPtr); extern String keyword(const char* keywordPtr);
extern bool eqls(const char* str, const char* keywordPtr); extern bool eqls(const char* str, const char* keywordPtr);