Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions esp8266_deauther/DisplayUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
});
});

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
}
Expand Down
3 changes: 3 additions & 0 deletions esp8266_deauther/DisplayUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion esp8266_deauther/esp8266_deauther.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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_DISPLAY;
}

// load everything else
Expand Down