build(wio-tracker-l2): LVGL 9.2.2 -> 9.6.0

The triangle draw descriptor's colour fields lost their bg_ prefix and style
getters take an lv_part_t. 9.6 sizes flex containers through the layout, so
popups no longer shrink when pulled past their end: lvgl_patches.py goes.
The sim wipes its LVGL object cache when the library version changes.
Flash +73 KB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-28 15:06:23 +02:00
co-authored by Claude Opus 5.5
parent 4d6e9ad20e
commit ed5c903c3b
6 changed files with 16 additions and 72 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ namespace anim {
lv_obj_remove_flag(cover, LV_OBJ_FLAG_CLICKABLE); // taps go through to the screen
lv_obj_add_flag(cover, LV_OBJ_FLAG_IGNORE_LAYOUT);
lv_obj_set_size(cover, LV_PCT(100), LV_PCT(100));
lv_obj_set_style_bg_color(cover, lv_obj_get_style_bg_color(scr, 0), 0);
lv_obj_set_style_bg_color(cover, lv_obj_get_style_bg_color(scr, LV_PART_MAIN), 0);
run(cover, setBgOpa, LV_OPA_COVER, LV_OPA_TRANSP, SCREEN_MS, coverDone);
if (body) run(body, setTy, back ? -6 : 6, 0, SCREEN_MS);
}
@@ -84,6 +84,6 @@ namespace anim {
// Fade out, then hide (the object stays for reuse).
static void fadeHide(lv_obj_t* o) {
lv_anim_delete(o, setOpa);
run(o, setOpa, lv_obj_get_style_opa(o, 0), LV_OPA_TRANSP, OUT_MS, hideDone);
run(o, setOpa, lv_obj_get_style_opa(o, LV_PART_MAIN), LV_OPA_TRANSP, OUT_MS, hideDone);
}
}
@@ -65,8 +65,8 @@ static void onCompassDraw(lv_event_t* e) {
// Fixed pointer: points down at the ring, the heading always under it.
lv_draw_triangle_dsc_t tri;
lv_draw_triangle_dsc_init(&tri);
tri.bg_color = lv_color_hex(theme::ACCENT);
tri.bg_opa = LV_OPA_COVER;
tri.color = lv_color_hex(theme::ACCENT);
tri.opa = LV_OPA_COVER;
tri.p[0].x = cx - 8; tri.p[0].y = cy - r - 12;
tri.p[1].x = cx + 8; tri.p[1].y = cy - r - 12;
tri.p[2].x = cx; tri.p[2].y = cy - r + 2;
@@ -1,60 +0,0 @@
# Fixes to LVGL 9.2.2 (lib_deps) that ui-lvgl needs, applied in place to the
# downloaded library -- idempotent, so every build can run it.
#
# PlatformIO: extra_scripts = pre:examples/companion_radio/ui-lvgl/lvgl_patches.py
# (patches as LVGL is compiled, i.e. after lib_deps are fetched)
# The sim: python3 examples/companion_radio/ui-lvgl/lvgl_patches.py <lvgl dir>
#
# Content height counted as scrolled (lv_obj_pos.c, calc_content_height): a
# SIZE_CONTENT box capped by max_height measures its children where the scroll
# has moved them, so an elastic pull past its end shrinks it by the overshoot,
# again on every pull (popups with a list). The function zeroes scroll.y for
# the count, but the children's coords already carry it; it's added back.
import os
import sys
PATCHES = [
("src/core/lv_obj_pos.c", [
(" /*Normal top aligns. */\n"
" child_res_tmp = child->coords.y2 - obj->coords.y1 + 1;\n",
" /*Normal top aligns. */\n"
" child_res_tmp = child->coords.y2 - obj->coords.y1 + 1 + scroll_y_tmp;\n"),
(" else {\n"
" child_res_tmp = child->coords.y2 - obj->coords.y1 + 1;\n"
" }\n",
" else {\n"
" child_res_tmp = child->coords.y2 - obj->coords.y1 + 1 + scroll_y_tmp;\n"
" }\n"),
]),
]
def apply(lvgl_dir):
for rel, subs in PATCHES:
path = os.path.join(lvgl_dir, rel)
with open(path) as f:
src = f.read()
out = src
for old, new in subs:
if new in out:
continue
if out.count(old) != 1:
raise RuntimeError("lvgl_patches: %s changed upstream, re-check the patch" % rel)
out = out.replace(old, new)
if out != src:
with open(path, "w") as f:
f.write(out)
print("lvgl_patches: patched %s" % rel)
if __name__ == "__main__":
apply(sys.argv[1])
else:
Import("env") # noqa: F821 (SCons)
def _patch(env, node):
path = node.srcnode().get_abspath()
apply(path[: path.rindex(os.sep + "src" + os.sep)])
return node
env.AddBuildMiddleware(_patch, "*/lvgl/src/core/lv_obj_pos.c") # noqa: F821
@@ -230,10 +230,10 @@ static void icon(lv_layer_t* layer, uint8_t cls, int32_t x, int32_t y) {
r.border_opa = LV_OPA_COVER;
lv_draw_triangle_dsc_t t;
lv_draw_triangle_dsc_init(&t);
t.bg_opa = LV_OPA_COVER;
t.opa = LV_OPA_COVER;
lv_area_t a;
auto tri = [&](uint32_t col, int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2) {
t.bg_color = lv_color_hex(col);
t.color = lv_color_hex(col);
t.p[0] = { (lv_value_precise_t)x0, (lv_value_precise_t)y0 };
t.p[1] = { (lv_value_precise_t)x1, (lv_value_precise_t)y1 };
t.p[2] = { (lv_value_precise_t)x2, (lv_value_precise_t)y2 };
+3 -5
View File
@@ -70,9 +70,6 @@ build_flags =
-D NEARBY_MAX=64
-D HIST_ARCHIVE ; message history also on the SD card (ui-lvgl/HistoryStore.h)
-D GPS_SKYVIEW ; satellites / signal / DOPs for the GPS screen (helpers/sensors/GpsSky.h)
extra_scripts =
${esp32_base.extra_scripts}
pre:examples/companion_radio/ui-lvgl/lvgl_patches.py ; fixes to LVGL itself
build_src_filter = ${Wio_Tracker_L2.build_src_filter}
+<helpers/esp32/*.cpp>
+<helpers/ui/LGFXDisplay.cpp>
@@ -84,7 +81,7 @@ build_src_filter = ${Wio_Tracker_L2.build_src_filter}
lib_deps =
${Wio_Tracker_L2.lib_deps}
densaugeo/base64 @ ~1.4.0
lvgl/lvgl @ 9.2.2 ; pinned: bump deliberately, re-test on hardware
lvgl/lvgl @ 9.6.0 ; pinned: bump deliberately, re-test on hardware
SD_MMC ; map tiles on the microSD (framework libraries from here on)
FS
WiFi ; on-device map download, live tiles, OTA
@@ -102,10 +99,11 @@ platform = ${esp32_base.platform}
lib_deps =
${Wio_Tracker_L2.lib_deps}
densaugeo/base64 @ ~1.4.0
lvgl/lvgl @ 9.2.2
lvgl/lvgl @ 9.6.0
SD_MMC
FS
WiFi
HTTPClient
WiFiClientSecure
Preferences
+7 -1
View File
@@ -246,7 +246,13 @@ if [ "$SIM_UI" = "lvgl" ]; then
# would shadow the libc <features.h> the C headers include.
C_FLAGS=(-std=gnu99 "${OPT_FLAGS[@]}" "${DEFINES[@]}" "-I$LVGL_DIR" -Iexamples/companion_radio/ui-lvgl)
LV_OBJ_DIR="$OUT_DIR/obj_lvgl"
python3 examples/companion_radio/ui-lvgl/lvgl_patches.py "$LVGL_DIR" # as the firmware build does
# Another LVGL version: its files needn't be newer than the cached objects.
LV_VER="$(grep '"version"' "$LVGL_DIR/library.json")"
if [ "$(cat "$LV_OBJ_DIR/.lvgl_version" 2>/dev/null)" != "$LV_VER" ]; then
rm -rf "$LV_OBJ_DIR"
mkdir -p "$LV_OBJ_DIR"
echo "$LV_VER" > "$LV_OBJ_DIR/.lvgl_version"
fi
C_SRCS=()
while IFS= read -r f; do C_SRCS+=("$f"); done < <(
find "$LVGL_DIR/src" -name '*.c' | sed "s|^$REPO_ROOT/||" | sort