From e6fe4fee27f22bbbc9d4b727b89bcdc26c3de93d Mon Sep 17 00:00:00 2001 From: Stefan Kremser Date: Sun, 14 Oct 2018 17:01:10 +0200 Subject: [PATCH] Fake clock enabled by default --- esp8266_deauther/DisplayUI.cpp | 16 +++------------- esp8266_deauther/DisplayUI.h | 3 +-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/esp8266_deauther/DisplayUI.cpp b/esp8266_deauther/DisplayUI.cpp index bfb93cb..292fb62 100644 --- a/esp8266_deauther/DisplayUI.cpp +++ b/esp8266_deauther/DisplayUI.cpp @@ -63,10 +63,8 @@ void DisplayUI::setup() { setupButtons(); buttonTime = currentTime; -#ifdef FAKE_CLOCK clockHour = random(12); clockMinute = random(60); -#endif // ifdef FAKE_CLOCK // ===== MENUS ===== // @@ -80,13 +78,11 @@ void DisplayUI::setup() { mode = DISPLAY_MODE::PACKETMONITOR; }); -#ifdef FAKE_CLOCK addMenuNode(&mainMenu, D_CLOCK, [this]() { // PACKET MONITOR mode = DISPLAY_MODE::CLOCK; display.setFont(ArialMT_Plain_24); display.setTextAlignment(TEXT_ALIGN_CENTER); }); -#endif // ifdef FAKE_CLOCK #ifdef HIGHLIGHT_LED addMenuNode(&mainMenu, D_LED, [this]() { // LED @@ -562,7 +558,9 @@ void DisplayUI::setupButtons() { else currentMenu->selected = 0; } else if (mode == DISPLAY_MODE::PACKETMONITOR) { // when in packet monitor, change channel scan.setChannel(wifi_channel - 1); - } else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor, change channel + } + + else if (mode == DISPLAY_MODE::CLOCK) { // when in packet monitor, change channel setTime(clockHour, clockMinute - 10, clockSecond); } } @@ -645,12 +643,10 @@ void DisplayUI::draw() { updatePrefix(); -#ifdef FAKE_CLOCK if (clockTime < currentTime - 1000) { setTime(clockHour, clockMinute++, clockSecond + 1); clockTime += 1000; } -#endif // ifdef FAKE_CLOCK switch (mode) { case DISPLAY_MODE::BUTTON_TEST: @@ -675,12 +671,9 @@ void DisplayUI::draw() { } drawIntro(); break; - -#ifdef FAKE_CLOCK case DISPLAY_MODE::CLOCK: drawClock(); break; -#endif // ifdef FAKE_CLOCK } updateSuffix(); @@ -760,7 +753,6 @@ void DisplayUI::drawIntro() { drawString(4, center(settings.getVersion(), maxLen)); } -#ifdef FAKE_CLOCK void DisplayUI::drawClock() { String clockTime = String(clockHour); @@ -771,8 +763,6 @@ void DisplayUI::drawClock() { display.drawString(64, 20, clockTime); } -#endif // ifdef FAKE_CLOCK - void DisplayUI::clearMenu(Menu* menu) { while (menu->list->size() > 0) { menu->list->remove(0); diff --git a/esp8266_deauther/DisplayUI.h b/esp8266_deauther/DisplayUI.h index a47b541..5f08bd9 100644 --- a/esp8266_deauther/DisplayUI.h +++ b/esp8266_deauther/DisplayUI.h @@ -166,7 +166,7 @@ class DisplayUI { void addMenuNode(Menu* menu, const char* ptr, std::functionclick); void addMenuNode(Menu* menu, const char* ptr, Menu* next); -#ifdef FAKE_CLOCK + // fake clock void drawClock(); void setTime(int h, int m, int s); @@ -175,7 +175,6 @@ class DisplayUI { int clockSecond = 0; uint32_t clockTime = 0; -#endif // ifdef FAKE_CLOCK }; // ===== FONT ===== //