From d7b0b2696c0cfd1fdf98d226f68b4d63eca95212 Mon Sep 17 00:00:00 2001 From: Blaine Booher Date: Fri, 14 Aug 2026 15:16:56 -0500 Subject: [PATCH] Fix flash overflow in esp32-cyd-capacitive-ip5306-shutdown build The shutdown countdown is the only user of lv_font_montserrat_48, which adds ~97KB to that env. The env last built at v1.2.1 (96.9% of the 1.69MiB OTA slot); the app growth in v1.2.2 pushed it to 102.3% and it has failed to build since. CI only compiles esp32-cyd, so the breakage went unnoticed. Gate the 48px font behind WLED_SCREEN_WIDTH >= 480 like montserrat_24/28 and fall back to montserrat_20 for the countdown on small screens. esp32-cyd-capacitive-ip5306-shutdown: 102.4% -> 96.9% of app slot; esp32-cyd unchanged in size; jc8048w550c/jc4880p443/macos still build and keep the 48px font where enabled. --- include/lv_conf.h | 6 ++++++ src/ui/ui.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/lv_conf.h b/include/lv_conf.h index cb7c2ce..a8a512d 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -140,7 +140,13 @@ #define LV_FONT_MONTSERRAT_42 0 #define LV_FONT_MONTSERRAT_44 0 #define LV_FONT_MONTSERRAT_46 0 +#if WLED_SCREEN_WIDTH >= 480 #define LV_FONT_MONTSERRAT_48 1 +#else +/* Only the shutdown countdown uses 48px; on 4MB CYDs the ~97KB font overflows + * the 1.69MiB OTA app slot, so small screens fall back to montserrat_20. */ +#define LV_FONT_MONTSERRAT_48 0 +#endif #define LV_FONT_MONTSERRAT_12_SUBPX 0 #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index afbbd70..9ba5144 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -265,7 +265,11 @@ void startShutdownUi() { shutdown_countdown_label = lv_label_create(shutdown_overlay); lv_label_set_text(shutdown_countdown_label, "10"); lv_obj_set_style_text_color(shutdown_countdown_label, lv_color_hex(kColorText), LV_PART_MAIN); +#if LV_FONT_MONTSERRAT_48 lv_obj_set_style_text_font(shutdown_countdown_label, &lv_font_montserrat_48, LV_PART_MAIN); +#else + lv_obj_set_style_text_font(shutdown_countdown_label, &lv_font_montserrat_20, LV_PART_MAIN); +#endif lv_obj_set_style_text_align(shutdown_countdown_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN); lv_obj_set_size(shutdown_countdown_label, LV_PCT(100), 64);