feat(lua): expose Disable Touch state - #7647
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 |
Summary
getTouchEnabled()Lua API on touch-capable buildsFUNCTION_DISABLE_TOUCHstate used by the input pathMotivation
Lua widgets and applications need access to radio/UI state so they can present that state in custom interfaces. This API is not intended to replace the firmware feedback discussed in #1085 or implemented by #7565; it is a general capability for Lua consumers.
Examples include a top-bar indicator, a custom control surface, or future widgets that combine touch state with other radio-state indicators.
Semantics and scope
getTouchEnabled()is available only onHARDWARE_TOUCHbuilds. It returnsfalsewhile a model or global Disable touch special function is active.The result represents that special-function state only. A
trueresult does not guarantee that touch events are currently accepted because the touch driver can suppress input for other reasons, such as while the backlight is off.Validation
Built the TX16SMK3 native radio test target in the official EdgeTX development container:
Lua.TouchEnabled: 1/1 passedUpstream GitHub Actions also passed completely:
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. This revision incorporates the post-close maintainer feedback and resolves both prior review threads.