diff --git a/.github/workflows/build-solo-sim.yml b/.github/workflows/build-solo-sim.yml index 5c24200c..81e19d04 100644 --- a/.github/workflows/build-solo-sim.yml +++ b/.github/workflows/build-solo-sim.yml @@ -1,7 +1,8 @@ name: Build Solo Sim (WASM) # Builds the companion_radio browser sim (real firmware compiled to WASM via -# Emscripten, see variants/sim/) and attaches it to the same draft release +# Emscripten, see variants/sim/) -- the OLED ui-new build, the Wio Tracker L2 +# ui-lvgl build and the repeater -- and attaches it to the same draft release # build-solo-firmwares.yml creates for this tag, as a single fixed-name # asset: solo-sim-wasm.zip. Fixed name (no version in it) so # meshcore-solo-site's server-side deploy script can always fetch it from @@ -59,13 +60,29 @@ jobs: FIRMWARE_VERSION: ${{ env.BUILD_VERSION }} run: variants/sim/build_wasm.sh + # LVGL at the version the L2 firmware pins, straight from its repo -- + # no PlatformIO needed just for the sources. + - name: Fetch LVGL + run: | + LV_VER="$(grep -m1 -oE 'lvgl/lvgl @ [0-9.]+' solo/wio-tracker-l2/platformio.ini | awk '{print $3}')" + echo "LVGL $LV_VER" + git clone --depth 1 --branch "v$LV_VER" https://github.com/lvgl/lvgl.git "$RUNNER_TEMP/lvgl" + + - name: Build L2 (LVGL) WASM + env: + FIRMWARE_VERSION: ${{ env.BUILD_VERSION }} + SIM_UI: lvgl + LVGL_DIR: ${{ runner.temp }}/lvgl + run: variants/sim/build_wasm.sh + - name: Build repeater WASM run: variants/sim/build_wasm_repeater.sh - name: Package run: | - mkdir -p out/wasm/companion out/wasm/repeater + mkdir -p out/wasm/companion out/wasm/lvgl out/wasm/repeater cp variants/sim/web/build/meshcore_sim.js variants/sim/web/build/meshcore_sim.wasm out/wasm/companion/ + cp variants/sim/web/build/meshcore_sim_lvgl.js variants/sim/web/build/meshcore_sim_lvgl.wasm out/wasm/lvgl/ cp variants/sim/web/build/repeater/meshcore_sim_repeater.js variants/sim/web/build/repeater/meshcore_sim_repeater.wasm out/wasm/repeater/ cd out && zip -r solo-sim-wasm.zip wasm diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index baf5db4f..4f3f2222 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -551,6 +551,17 @@ extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_set_timezone_hours(int hours) { // UITask::loop() entirely -- there's no separate flag to touch. A demo // running on a visitor's screen has no battery to save and no reason to // go dark or lock itself while they're reading it. +// Renames this instance (NodePrefs::node_name, what Settings > Name sets) so +// a host page's peers have readable names in screenshots, instead of the +// default hex of their public key. In memory only; the next advert carries it. +extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_set_node_name(const char* name) { + if (!g_sim_ready || !name || !*name) return 0; + NodePrefs* prefs = the_mesh.getNodePrefs(); + if (!prefs) return 0; + snprintf(prefs->node_name, sizeof(prefs->node_name), "%s", name); + return 1; +} + extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_disable_screen_timeout() { if (!g_sim_ready) return 0; NodePrefs* prefs = the_mesh.getNodePrefs(); diff --git a/variants/sim/build_wasm.sh b/variants/sim/build_wasm.sh index 1d002417..4754ba7c 100755 --- a/variants/sim/build_wasm.sh +++ b/variants/sim/build_wasm.sh @@ -55,9 +55,11 @@ fi # Which frontend: SIM_UI=new (default, 128x64 OLED-style ui-new) or # SIM_UI=lvgl (320x240 touch ui-lvgl, Wio Tracker L2 shape -> web/lvgl.html). # The lvgl build takes the LVGL 9 sources from PlatformIO's libdeps of the L2 -# env, so run `pio run -e Wio_Tracker_L2_companion_solo_lvgl` once first. +# env, so run `pio run -e Wio_Tracker_L2_companion_solo_lvgl` once first, or +# point LVGL_DIR at a checkout of the same version (CI does, see +# .github/workflows/build-solo-sim.yml). SIM_UI="${SIM_UI:-new}" -LVGL_DIR="$REPO_ROOT/.pio/libdeps/Wio_Tracker_L2_companion_solo_lvgl/lvgl" +LVGL_DIR="${LVGL_DIR:-$REPO_ROOT/.pio/libdeps/Wio_Tracker_L2_companion_solo_lvgl/lvgl}" if [ "$SIM_UI" = "lvgl" ] && [ ! -f "$LVGL_DIR/lvgl.h" ]; then echo "error: LVGL sources not found at $LVGL_DIR" >&2 echo "Fetch them first: pio run -e Wio_Tracker_L2_companion_solo_lvgl" >&2