From f31147248b7281b61d8a92db55e1478e74323618 Mon Sep 17 00:00:00 2001 From: Benji <89719460+Proto-molecule@users.noreply.github.com> Date: Wed, 5 Jan 2022 00:08:51 -0800 Subject: [PATCH] Update usermod_v2_four_line_display_ALT.h added draft for logo --- .../usermod_v2_four_line_display_ALT.h | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h index f7812d75b..e18cb27fa 100644 --- a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h +++ b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h @@ -261,7 +261,7 @@ class FourLineDisplayUsermod : public Usermod { setContrast(contrast); //Contrast setup will help to preserve OLED lifetime. In case OLED need to be brighter increase number up to 255 setPowerSave(0); //drawString(0, 0, "Loading..."); - overlay(PSTR("Loading..."),3000,9); + overlayLogo(PSTR("Loading..."),3000,1); } // gets called every time WiFi is (re-)connected. Initialize own network @@ -608,6 +608,28 @@ class FourLineDisplayUsermod : public Usermod { } overlayUntil = millis() + showHowLong; } + /** + * Allows you to show one line and a glyph as overlay for a period of time. + * Clears the screen and prints. + * Used in Rotary Encoder usermod. + */ + void overlayLogo(const char* line1, long showHowLong, byte glyphType) { + // Turn the display back on + if (!wakeDisplay()) clear(); + // Print the overlay + if (glyphType>0 && glyphType<255) { + if (lineHeight == 2){ drawGlyph(2, 1, 1, u8x8_WLED_logo_4x4, true); + drawGlyph(6, 1, 2, u8x8_WLED_logo_4x4, true); + drawGlyph(10, 1, 3, u8x8_WLED_logo_4x4, true); + }else drawGlyph(7, lineHeight, glyphType, u8x8_4LineDisplay_WLED_icons_2x2, true); + } + if (line1) { + String buf = line1; + center(buf, getCols()); + drawString(0, (glyphType<255?3:0)*lineHeight, buf.c_str()); + } + overlayUntil = millis() + showHowLong; + } /** * Allows you to show two lines as overlay for a period of time.