diff --git a/src/display.cpp b/src/display.cpp index 26e9d0b..1ac3701 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -154,6 +154,7 @@ void display_toggle(bool toggle) { } void show_display(const String& header, const String& line1, const String& line2, int wait) { + const String* const lines[] = {&line1, &line2}; #ifdef HAS_TFT cleanTFT(); tft.setTextColor(TFT_WHITE,TFT_BLACK); @@ -161,10 +162,16 @@ void show_display(const String& header, const String& line1, const String& line2 tft.setCursor(0, 0); tft.print(header); tft.setTextSize(smallSizeFont); - tft.setCursor(0, ((lineSpacing * 2) - 2)); + + for (int i = 0; i < 2; i++) { + tft.setCursor(0, ((lineSpacing * (2 + i)) - 2)); + tft.print(*lines[i]); + } + /*tft.setCursor(0, ((lineSpacing * 2) - 2)); tft.print(line1); tft.setCursor(0, ((lineSpacing * 3) - 2)); - tft.print(line2); + tft.print(line2);*/ + #else display.clearDisplay(); #ifdef ssd1306 @@ -176,10 +183,16 @@ void show_display(const String& header, const String& line1, const String& line2 display.setCursor(0, 0); display.println(header); display.setTextSize(1); - display.setCursor(0, 16); + + for (int i = 0; i < 2; i++) { + display.setCursor(0, 16 + (10 * i)); + display.println(*lines[i]); + } + + /*display.setCursor(0, 16); display.println(line1); display.setCursor(0, 26); - display.println(line2); + display.println(line2);*/ #ifdef ssd1306 display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(screenBrightness); @@ -192,6 +205,7 @@ void show_display(const String& header, const String& line1, const String& line2 } void show_display(const String& header, const String& line1, const String& line2, const String& line3, const String& line4, const String& line5, int wait) { + const String* const lines[] = {&line1, &line2, &line3, &line4, &line5}; #ifdef HAS_TFT if (menuDisplay != lastMenuDisplay) { lastMenuDisplay = menuDisplay; @@ -203,7 +217,13 @@ void show_display(const String& header, const String& line1, const String& line2 tft.setCursor(0, 0); tft.print(header); tft.setTextSize(smallSizeFont); - tft.setCursor(0, ((lineSpacing * 2) - 2)); + + for (int i = 0; i < 5; i++) { + tft.setCursor(0, ((lineSpacing * (2 + i)) - 2)); + tft.print(*lines[i]); + } + + /*tft.setCursor(0, ((lineSpacing * 2) - 2)); tft.print(line1); tft.setCursor(0, ((lineSpacing * 3) - 2)); tft.print(line2); @@ -212,7 +232,7 @@ void show_display(const String& header, const String& line1, const String& line2 tft.setCursor(0, ((lineSpacing * 5) - 2)); tft.print(line4); tft.setCursor(0, ((lineSpacing *6) - 2)); - tft.print(line5); + tft.print(line5);*/ if (menuDisplay == 0 && Config.display.showSymbol) { int symbol = 100; @@ -261,7 +281,13 @@ void show_display(const String& header, const String& line1, const String& line2 display.setCursor(0, 0); display.println(header); display.setTextSize(1); - display.setCursor(0, 16); + + for (int i = 0; i < 5; i++) { + display.setCursor(0, 16 + (10 * i)); + display.println(*lines[i]); + } + + /*display.setCursor(0, 16); display.println(line1); display.setCursor(0, 26); display.println(line2); @@ -270,7 +296,8 @@ void show_display(const String& header, const String& line1, const String& line2 display.setCursor(0, 46); display.println(line4); display.setCursor(0, 56); - display.println(line5); + display.println(line5);*/ + #ifdef ssd1306 display.ssd1306_command(SSD1306_SETCONTRAST); display.ssd1306_command(screenBrightness); diff --git a/src/power_utils.cpp b/src/power_utils.cpp index f3b780b..c8aad98 100644 --- a/src/power_utils.cpp +++ b/src/power_utils.cpp @@ -5,6 +5,7 @@ #include "power_utils.h" #include "lora_utils.h" #include "ble_utils.h" +#include "display.h" #include "logger.h" @@ -461,6 +462,7 @@ namespace POWER_Utils { logger.log(logging::LoggerLevel::LOGGER_LEVEL_WARN, "Main", "SHUTDOWN !!!"); #if defined(HAS_AXP192) || defined(HAS_AXP2101) if (Config.notification.shutDownBeep) NOTIFICATION_Utils::shutDownBeep(); + display_toggle(false); PMU.shutdown(); #else