This document describes the important startup and Compile-to-RAM sequencing used by the v6.15/v6.16 baseline.
Expected startup sequence:
- ESP-IDF bootloader starts the app.
- PSRAM is detected and added to the heap.
- SPIFFS storage is mounted.
- LCD, touch, RGB panel, and LVGL port are initialized with the backlight off.
- AngelScript is initialized and compiled before the HMI is visible.
- Saved HMI layout is loaded from SPIFFS.
- The active page is built by the LVGL runtime.
OnPanelStart()runs.- The backlight is enabled after the HMI is ready.
- Wi-Fi AP and HTTP server start.
- Periodic health summaries begin.
The key principle is that the user should not see the HMI until script and layout are ready.
Compile-to-RAM is the most timing-sensitive operation in the system. The intended sequence is:
- Browser sends script compile request.
- Runtime marks script state as queued.
- Runtime enters
SCRIPT_COMPILING. - LCD backlight turns off.
- Active HMI page tree is dropped.
- LVGL timer/rendering is paused.
- Persistent compile worker performs AngelScript compilation.
- LVGL timer/rendering resumes.
- HMI layout rebuild is deferred until the runtime guard releases.
- Active HMI page is rebuilt from the saved layout model.
OnPanelStart()runs after successful compile.- Runtime enters
LAYOUT_RELOADING, thenREADY. - LCD backlight turns on after the reload has settled.
Expected result after a successful Compile-to-RAM:
state=READY
script={state=ok valid=1 ... modules=1 engines=1 ...}
Generation count should increase. The active module name may change, but module count should remain 1.
Expected result after a failed Compile-to-RAM:
- compile error is reported
- runtime script state becomes
error - previous valid module remains usable
- active HMI layout is rebuilt
- runtime returns to
READY - module count remains 1
- engine count remains 1
After fixing the script, another Compile-to-RAM should return script state to ok.
The backlight should be considered a visual commit signal.
If the screen is being compiled/reloaded/rebuilt, the backlight should stay off. It should turn on only after the active HMI page is rebuilt and the reload has settled.
This rule avoids visible partial renders, offset screens, and half-built widgets.
Large LVGL object deletion and rebuild should happen in controlled runtime paths, not randomly from unrelated tasks.
The active page tree is intentionally dropped during maintenance mode. It is rebuilt after compile completion through the runtime reload path.
The intended steady-state script lifetime is:
engines=1
modules=1
If a future change causes module count or engine count to grow after repeated Compile-to-RAM operations, treat it as a regression.