File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8585
8686mkdir -p " $BUILD_DIR "
8787
88- # Switching to --local with Ninja: clear a Unix Makefiles (or other) cache once.
89- if [ " $LOCAL_BUILD " = 1 ] && [ " ${# CMAKE_GEN_ARGS[@]} " -gt 0 ]; then
90- if [ -f " $BUILD_DIR /CMakeCache.txt" ]; then
91- if ! grep -q ' ^CMAKE_GENERATOR:INTERNAL=Ninja$' " $BUILD_DIR /CMakeCache.txt" 2> /dev/null; then
92- echo " Local build: clearing $BUILD_DIR to switch CMake generator to Ninja..."
93- rm -rf " $BUILD_DIR "
94- mkdir -p " $BUILD_DIR "
95- fi
88+ # If the cached generator or build type no longer matches, clear the build dir once.
89+ if [ -f " $BUILD_DIR /CMakeCache.txt" ]; then
90+ cached_gen=$( grep ' ^CMAKE_GENERATOR:INTERNAL=' " $BUILD_DIR /CMakeCache.txt" 2> /dev/null | cut -d= -f2)
91+ cached_type=$( grep ' ^CMAKE_BUILD_TYPE:STRING=' " $BUILD_DIR /CMakeCache.txt" 2> /dev/null | cut -d= -f2)
92+ want_gen=" Unix Makefiles"
93+ [ " ${# CMAKE_GEN_ARGS[@]} " -gt 0 ] && want_gen=" Ninja"
94+ if [ " $cached_gen " != " $want_gen " ] || [ " $cached_type " != " $BUILD_TYPE " ]; then
95+ echo " Clearing $BUILD_DIR (generator/build type changed: ${cached_gen} /${cached_type} -> ${want_gen} /${BUILD_TYPE} )..."
96+ rm -rf " $BUILD_DIR "
97+ mkdir -p " $BUILD_DIR "
9698 fi
9799fi
98100
99101cd " $BUILD_DIR "
100102
101103echo " "
102104echo " --- Configuring CMake ---"
105+ # --local uses RelWithDebInfo: optimized binary (5-10x faster renderer) with debug symbols.
106+ # CI keeps Debug for faithful failure diagnostics.
107+ BUILD_TYPE=" Debug"
108+ [ " $LOCAL_BUILD " = 1 ] && BUILD_TYPE=" RelWithDebInfo"
103109# shellcheck disable=SC2086
104110cmake " $SCRIPT_DIR " \
105- -DCMAKE_BUILD_TYPE=Debug \
111+ -DCMAKE_BUILD_TYPE=" $BUILD_TYPE " \
106112 " ${CMAKE_GEN_ARGS[@]} " \
107113 " ${CMAKE_CCACHE_ARGS[@]} " \
108114 ${LVGL_DIR: +-DLVGL_DIR=" $LVGL_DIR " } \
Original file line number Diff line number Diff line change 1212// Full-screen framebuffer: 160 x 128 pixels, RGB565
1313static uint16_t framebuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
1414
15- // LVGL draw buffers (full-screen for complete frame capture)
16- static uint8_t lvgl_buf1[SCREEN_WIDTH * SCREEN_HEIGHT * 2 ];
15+ // LVGL draw buffer - must be aligned to LV_DRAW_BUF_ALIGN (4 bytes).
16+ // LVGL v9 asserts on misaligned buffers and spins in while(1) on failure.
17+ static uint8_t lvgl_buf1[SCREEN_WIDTH * SCREEN_HEIGHT * 2 ] __attribute__((aligned(4 )));
1718
1819// Define globals declared in lvgl_core.h
1920lv_display_t * main_display = nullptr ;
@@ -81,9 +82,14 @@ lv_display_t* emulator_init_display(bool darkMode) {
8182}
8283
8384void emulator_render_frame () {
84- // Tick LVGL forward to process any pending timers/animations
85+ // Tick LVGL forward so any time-dependent layout/animation work is scheduled.
8586 lv_tick_inc (100 );
86- // Force a full refresh
87+ // Drain LVGL's internal timer queue before forcing the refresh. Without
88+ // this the first render on a freshly-created screen can block waiting for
89+ // deferred layout passes that are only triggered by lv_timer_handler().
90+ for (int i = 0 ; i < 64 ; i++) {
91+ lv_timer_handler ();
92+ }
8793 lv_refr_now (main_display);
8894}
8995
You can’t perform that action at this time.
0 commit comments