Skip to content

feat(simu): add opt-in Widget Studio automation hooks - #7646

Draft
bultodepapas wants to merge 1 commit into
EdgeTX:mainfrom
bultodepapas:feat/widget-studio-simulator
Draft

feat(simu): add opt-in Widget Studio automation hooks#7646
bultodepapas wants to merge 1 commit into
EdgeTX:mainfrom
bultodepapas:feat/widget-studio-simulator

Conversation

@bultodepapas

Copy link
Copy Markdown
Contributor

Summary of changes:

Adds an experimental, opt-in WIDGET_STUDIO mode to the native color-LCD simulator so visual Lua/LVGL tooling can drive the real EdgeTX runtime instead of maintaining a parallel renderer.

The option defaults to OFF and does not affect radio firmware, Companion embedding, or WASM builds.

What is included:

  • an append-only --pipe <path> command-file interface for key, touch, capture, reset, reload, and exit commands
  • deterministic one-shot PNG capture from the real RGB565 LCD framebuffer, including a forced LVGL redraw for static screens
  • a simulator-only Lua simu table for named switch/analog input control, SD-mapped capture, and asynchronous reset
  • synchronized shared state for firmware/Lua and SDL/UI threads
  • documentation for the build option, command protocol, Lua API, capture behavior, and trust boundary

Implementation notes:

  • WIDGET_STUDIO is defined only for the seven sources that implement the hooks.
  • The stb PNG implementation is linked only into the interactive simu executable, avoiding duplicate stb symbols in gtests-radio and excluding it from WASM.
  • The command reader tracks a monotonic offset, preserves partial lines, handles LF/CRLF and file shrink, and reads only the observed byte range so concurrent appends are not replayed.
  • Host paths supplied through --pipe are intentionally treated as trusted local-development input. Lua capture paths are resolved through the configured SD-card mapping.

Validation performed on Windows with Ninja/MinGW, PCB=TX16SMK3, and Companion disabled:

  • full WIDGET_STUDIO=OFF simu build passed; --help does not expose --pipe
  • full WIDGET_STUDIO=ON simu build passed; --help exposes --pipe
  • verified only seven object build rules receive WIDGET_STUDIO
  • live headless run passed command-file truncation/resynchronization, incomplete-line buffering, paths containing spaces, reload, hot reset, repeated capture, invalid-key rejection, and clean exit (code 0)
  • both generated PNGs had valid signatures and were visually inspected at the native 800x480 framebuffer size
  • all 35 gtests-radio source objects compiled; the final local Windows link is blocked by the existing unconditional -fsanitize=address test flag because this MinGW installation has no libasan

This is intentionally a draft for maintainer feedback on the option/API shape and naming before treating it as a stable development interface.

This PR is independent of the Gauge Pro SD-card contribution (EdgeTX/edgetx-sdcard#289); the widgets do not depend on these hooks, although the hooks were used to exercise their visual catalog locally.

@bultodepapas

Copy link
Copy Markdown
Contributor Author

CI status note: all documentation, test, and firmware-build jobs passed. Package firmwares successfully merged and uploaded all 19 artifacts, then failed during source-artifact cleanup with 404 Not Found: artifact does not exist. The contributor account does not have permission to rerun the upstream workflow.

@philmoz, could you provide early feedback on the opt-in option name, command protocol, and simulator-only Lua API while this remains a draft? If appropriate, could a maintainer also rerun the failed packaging job?

@pfeerick

Copy link
Copy Markdown
Member

This looks like some overlap with #7337 at first glance? The build error seems to be a network outage issue, will probably resolve on the next commit.

@bultodepapas

Copy link
Copy Markdown
Contributor Author

Thanks, @pfeerick. I agree that the overlap with #7337 is substantial and should be resolved before this draft grows further.

I opened #7668 as a collaborative consolidation draft. It uses #7337 as the generic harness foundation, carries forward the Windows, reset/reload, state-injection, and render-complete capture requirements explored here, and explicitly removes the duplicate or Widget Studio-specific surfaces.

I am not closing this PR yet. The new draft starts with the full contract, keep/drop matrix, phased implementation plan, tests, attribution policy, and rollback so @onliner10 and the simulator maintainers can shape the direction before implementation. The packaging failure is secondary until that direction is agreed.

bultodepapas added a commit to bultodepapas/edgetx-GR that referenced this pull request Aug 18, 2026
Add bounded status and describe responses backed by the simulator session state, then validate discovery and poll first-frame readiness from the cross-platform host session.

This consolidates the host lifecycle and discovery direction from EdgeTX#7337 with the guarded epoch and first-frame state model from EdgeTX#7646. Credit to @onliner10 and @pfeerick for the two approaches brought together here.
bultodepapas added a commit to bultodepapas/edgetx-GR that referenced this pull request Aug 18, 2026
Implement Phase 4 of the consolidated simulator automation plan: target-filtered key, rotary, and touch primitives; an asynchronous real-LCD frame barrier; host-side timed composites; release cleanup; and focused native/Python coverage.

This combines the portable host-side composition direction from EdgeTX#7337 with the direct simulator helpers and explicit touch transitions explored in EdgeTX#7646. Thanks to Mateusz Urban (@onliner10) for the original harness direction; review remains explicitly invited in EdgeTX#7668.
bultodepapas added a commit to bultodepapas/edgetx-GR that referenced this pull request Aug 18, 2026
Capture a strictly newer RGB565 framebuffer after an LVGL invalidation, publish deterministic PPM artifacts without replacement, and convert them to verified PNG metadata in the host client.

This combines the portable PPM and client direction from EdgeTX#7337 with the static-screen invalidation approach from EdgeTX#7646.

Thanks to @onliner10 for the original harness and capture direction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants