From fdd6603bd9ce7c12cc4f8362d7b1e2c20ba02d4b Mon Sep 17 00:00:00 2001 From: Focault Date: Mon, 11 Aug 2025 19:11:27 +0300 Subject: [PATCH 1/2] Clock-first deauther-second interface --- esp8266_deauther/DisplayUI.cpp | 24 +++++++++++++++--------- esp8266_deauther/DisplayUI.h | 3 +++ esp8266_deauther/esp8266_deauther.ino | 3 ++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/esp8266_deauther/DisplayUI.cpp b/esp8266_deauther/DisplayUI.cpp index 34d953cf..608af61a 100644 --- a/esp8266_deauther/DisplayUI.cpp +++ b/esp8266_deauther/DisplayUI.cpp @@ -14,7 +14,7 @@ void DisplayUI::configInit() { make sure to have version 4 of the display library installed https://github.com/ThingPulse/esp8266-oled-ssd1306/releases/tag/4.0.0 */ - display.setFont(DejaVu_Sans_Mono_12); + setDefaultFont(); display.setContrast(255); @@ -445,13 +445,11 @@ void DisplayUI::setup() { createMenu(&clockMenu, &mainMenu, [this]() { addMenuNode(&clockMenu, D_CLOCK_DISPLAY, [this]() { // CLOCK mode = DISPLAY_MODE::CLOCK_DISPLAY; - display.setFont(ArialMT_Plain_24); - display.setTextAlignment(TEXT_ALIGN_CENTER); + setClockFont(); }); addMenuNode(&clockMenu, D_CLOCK_SET, [this]() { // CLOCK SET TIME mode = DISPLAY_MODE::CLOCK; - display.setFont(ArialMT_Plain_24); - display.setTextAlignment(TEXT_ALIGN_CENTER); + setClockFont(); }); }); @@ -514,6 +512,16 @@ void DisplayUI::off() { } } +void DisplayUI::setDefaultFont() { + display.setFont(DejaVu_Sans_Mono_12); + display.setTextAlignment(TEXT_ALIGN_LEFT); +} + +void DisplayUI::setClockFont() { + display.setFont(ArialMT_Plain_24); + display.setTextAlignment(TEXT_ALIGN_CENTER); +} + void DisplayUI::setupButtons() { up = new ButtonPullup(BUTTON_UP); down = new ButtonPullup(BUTTON_DOWN); @@ -612,8 +620,7 @@ void DisplayUI::setupButtons() { case DISPLAY_MODE::CLOCK: case DISPLAY_MODE::CLOCK_DISPLAY: mode = DISPLAY_MODE::MENU; - display.setFont(DejaVu_Sans_Mono_12); - display.setTextAlignment(TEXT_ALIGN_LEFT); + setDefaultFont(); break; } } @@ -651,8 +658,7 @@ void DisplayUI::setupButtons() { case DISPLAY_MODE::CLOCK: mode = DISPLAY_MODE::MENU; - display.setFont(DejaVu_Sans_Mono_12); - display.setTextAlignment(TEXT_ALIGN_LEFT); + setDefaultFont(); break; } } diff --git a/esp8266_deauther/DisplayUI.h b/esp8266_deauther/DisplayUI.h index 67eee6d3..873ea73f 100644 --- a/esp8266_deauther/DisplayUI.h +++ b/esp8266_deauther/DisplayUI.h @@ -132,6 +132,9 @@ class DisplayUI { void on(); void off(); + void setDefaultFont(); + void setClockFont(); + private: int16_t selectedID = 0; // i.e. access point ID to draw the apMenu uint8_t scrollCounter = 0; // for horizontal scrolling diff --git a/esp8266_deauther/esp8266_deauther.ino b/esp8266_deauther/esp8266_deauther.ino index fc506e5c..800aeb8a 100644 --- a/esp8266_deauther/esp8266_deauther.ino +++ b/esp8266_deauther/esp8266_deauther.ino @@ -114,7 +114,8 @@ void setup() { // start display if (settings::getDisplaySettings().enabled) { displayUI.setup(); - displayUI.mode = DISPLAY_MODE::INTRO; + displayUI.setClockFont(); + displayUI.mode = DISPLAY_MODE::CLOCK; } // load everything else From 7a621b7e50a2832ae8941385b964c2e47e95bf9c Mon Sep 17 00:00:00 2001 From: Focault Date: Mon, 11 Aug 2025 19:28:39 +0300 Subject: [PATCH 2/2] Now opens in CLOCK_DISPLAY and not in the CLOCK setting screen --- esp8266_deauther/esp8266_deauther.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp8266_deauther/esp8266_deauther.ino b/esp8266_deauther/esp8266_deauther.ino index 800aeb8a..e9ede68c 100644 --- a/esp8266_deauther/esp8266_deauther.ino +++ b/esp8266_deauther/esp8266_deauther.ino @@ -115,7 +115,7 @@ void setup() { if (settings::getDisplaySettings().enabled) { displayUI.setup(); displayUI.setClockFont(); - displayUI.mode = DISPLAY_MODE::CLOCK; + displayUI.mode = DISPLAY_MODE::CLOCK_DISPLAY; } // load everything else