From 3a294d0852bf8f16534bed3a976493bbaac21aa6 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:44:30 +0100 Subject: [PATCH] four-line-display ALT: nicer font use a nicer, less blocky font on 128x64 OLED displays (ESP32 only) --- .../usermod_v2_four_line_display_ALT.h | 21 +++++++++++++++++++ wled00/wled.h | 2 +- 2 files changed, 22 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 5a9994b4..dd8ec2db 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 @@ -216,15 +216,36 @@ class FourLineDisplayUsermod : public Usermod { void drawString(uint8_t col, uint8_t row, const char *string, bool ignoreLH=false) { if (!typeOK || !enabled) return; // WLEDMM make sure the display is initialized before we try to draw on it if (u8x8 == nullptr) return; +#ifdef ARDUINO_ARCH_ESP32 // WLEDMM use nicer 2x1 font on ESP32 + if (!ignoreLH && lineHeight==2) { + if(strlen(string) > 3) // WLEDMM little hack - less than 3 chars -> show in bold + u8x8->setFont(u8x8_font_7x14_1x2_r); // normal + else + u8x8->setFont(u8x8_font_8x13B_1x2_r); // bold + u8x8->drawString(col, row, string); + } + else { + u8x8->setFont(u8x8_font_chroma48medium8_r); // crashes randomly on ESP32 + u8x8->drawString(col, row, string); // crashes randomly on ESP32 + } +#else u8x8->setFont(u8x8_font_chroma48medium8_r); if (!ignoreLH && lineHeight==2) u8x8->draw1x2String(col, row, string); else u8x8->drawString(col, row, string); +#endif } void draw2x2String(uint8_t col, uint8_t row, const char *string) { if (!typeOK || !enabled) return; if (u8x8 == nullptr) return; +#ifdef ARDUINO_ARCH_ESP32 // WLEDMM use nicer 2x2 font on ESP32 + //u8x8->setFont(u8x8_font_lucasarts_scumm_subtitle_o_2x2_r); + //u8x8->setFont(u8x8_font_lucasarts_scumm_subtitle_r_2x2_r); + u8x8->setFont(u8x8_font_px437wyse700b_2x2_r); + u8x8->drawString(col, row + row/8, string); +#else u8x8->setFont(u8x8_font_chroma48medium8_r); u8x8->draw2x2String(col, row, string); +#endif } void drawGlyph(uint8_t col, uint8_t row, char glyph, const uint8_t *font, bool ignoreLH=false) { if (!typeOK || !enabled) return; diff --git a/wled00/wled.h b/wled00/wled.h index 761d8549..6558f0cd 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2303081 +#define VERSION 2303082 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG