feat(sim): e-ink simulator builds

SIM_EINK=landscape|portrait builds the e-ink firmware for the browser,
drawn by the same EinkGfxDisplay as the panel. index.html and mesh.html
pick a build from the URL. The simulated sensors get a GPS switch, so the
UI's GPS toggle works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-02 19:24:36 +02:00
co-authored by Claude Opus 5.5
parent b0e24bb076
commit 2589fe95ce
6 changed files with 157 additions and 5 deletions
+24
View File
@@ -24,6 +24,8 @@
# Usage:
# variants/sim/build_wasm.sh # release-ish build (-O2)
# variants/sim/build_wasm.sh debug # -O0 -g, easier to debug in devtools
# SIM_UI=lvgl variants/sim/build_wasm.sh # the L2 (web/lvgl.html)
# SIM_EINK=landscape variants/sim/build_wasm.sh # the L1 E-ink, also portrait
#
# Requires emsdk 6.0.9 (pinned; see variants/sim/tools/emsdk/ -- installed by
# this same task, see the Phase 2 report for the exact activation command).
@@ -192,6 +194,28 @@ if [ "$SIM_UI" = "lvgl" ]; then
LINK_EXTRA=(-sFETCH=1) # map downloads (LvglPort.h) go through emscripten_fetch
fi
# SIM_EINK=landscape|portrait: ui-new on the Wio Tracker L1 E-ink's 2.13" panel
# (122x250, solo/wio-tracker-l1-eink's two builds) instead of the OLED ->
# web/index.html?build=meshcore_sim_eink_landscape (or _portrait).
SIM_EINK="${SIM_EINK:-}"
if [ -n "$SIM_EINK" ]; then
case "$SIM_EINK" in
landscape) EINK_DEFS=(-DDISPLAY_ROTATION=1 -DEINK_LARGE_FONT=1) ;;
portrait) EINK_DEFS=(-DDISPLAY_ROTATION=0) ;;
*) echo "error: SIM_EINK must be landscape or portrait" >&2; exit 1 ;;
esac
OUT_NAME="meshcore_sim_eink_$SIM_EINK"
EXPORT_NAME=MeshCoreSimEink # distinct factory: web/mesh.html?a=... loads it beside MeshCoreSim
kept=()
for d in "${DEFINES[@]}"; do
case "$d" in -DDISPLAY_CLASS=*|-DMAX_GROUP_CHANNELS=*) ;; *) kept+=("$d") ;; esac
done
# EINK_DISPLAY_MODEL is only tested for presence outside GxEPDDisplay
# (Features.h: the e-ink settings and timings), which the sim doesn't build.
DEFINES=("${kept[@]}" -DDISPLAY_CLASS=SimEinkDisplay -DSIM_EINK_PANEL_W=122 -DSIM_EINK_PANEL_H=250
-DEINK_DISPLAY_MODEL=SimEinkPanel -DMAX_GROUP_CHANNELS=40 "${EINK_DEFS[@]}")
fi
# -funsigned-char: carried over from Phase 1 verbatim -- real ARM cores
# default `char` to unsigned; em++'s target (wasm32) defaults it to signed,
# same mismatch Phase 1 hit on a native x86/ARM64 host, for the same reason