feat(lua): expose effective touch state - #7647
bultodepapas wants to merge 2 commits into
Conversation
|
@pfeerick, this is the clean successor to #7593 following your post-close feedback. It is now framed as a general Lua radio/UI-state API, rebased onto current |
There was a problem hiding this comment.
Pull request overview
This PR adds a small, touch-hardware-gated Lua API to let Lua widgets/apps query whether the firmware’s “Disable touch” special-function state is currently active, matching the state already used in the input/UI path.
Changes:
- Added
getTouchEnabled()to the general Lua API onHARDWARE_TOUCHbuilds, returningtrueunlessFUNCTION_DISABLE_TOUCHis active. - Documented the API’s semantics (special-function state only; not a guarantee the driver is accepting touches).
- Added a Lua unit test covering both model and global special-function activation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| radio/src/lua/api_general.cpp | Adds the getTouchEnabled() Lua binding (touch-only) and luadoc entry. |
| radio/src/tests/lua.cpp | Adds a touch-only Lua test verifying behavior for model vs global disable-touch state. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
I think it should return nil when no touch is present:
|
|
The current implementation is focused on |
7d3b572 to
9b5a0b0
Compare
|
Addressed both review points after rebasing onto current
On touch targets it now mirrors the firmware input gates: it returns Regression coverage now exercises touch enabled, model/global Disable touch, backlight off, and non-touch targets. Local validation passed:
The PR description and Lua API documentation have also been updated to state these semantics explicitly. |
- Horus builds set HARDWARE_TOUCH for all PCBs, including X10/X12S which have no touch panel; use the runtime HAS_TOUCH_PANEL() check where the board provides it. - Document that a touch while the backlight is off still wakes the screen. - Test: save/restore function contexts instead of clearing them, and cover the activeUIFunctions path. - Align @status wording with the other 3.0 entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
getTouchEnabled()API to the general Lua library on every target.nilon radios built without a touchscreen, so scripts can detect unsupported hardware safely.Motivation
Lua widgets and applications need a reliable way to inspect the radio's effective touch-input state for indicators and custom interfaces. This remains independent of the firmware feedback discussed in #1085 and implemented by #7565.
Semantics
getTouchEnabled()returns:truewhen the target has a touchscreen, the backlight is on, and Disable touch is inactive.falsewhen the target has a touchscreen but touch input is currently gated by the backlight or a model/global Disable touch function.nilwhen the target has no touchscreen.The API is registered unconditionally, which avoids a missing-function error in portable scripts.
Validation
Native test suites built with warnings treated as errors:
Representative Release ARM firmware-size builds also passed for TX16SMK3 and V12.
The
3.0.0Lua documentation tag matches the version declared by currentmain.Supersedes #7593. GitHub does not allow that closed PR to be reopened because its head was rebased/force-pushed.