docs(lua): add luadoc annotations for the LVGL Lua API - #7771
Conversation
radio/src/lua/api_colorlcd_lvgl.cpp implements ~45 LVGL Lua bindings (buttons, sliders, labels, containers, dialogs, and other GUI controls for color-LCD scripts) but had zero /*luadoc*/ annotations, so the Lua-reference-guide doc-generation pipeline could extract nothing for LVGL at all. The official EdgeTX Lua reference guide has long carried full, accurate LVGL documentation for this exact file, written by philmoz (GitHub handle phil.a.mitchell in the docs repo's GitBook history), who also implemented the large majority of this file's actual C++ bindings. That content lived only in the docs repo, disconnected from the source it describes, which is what let it drift and made it impossible for any doc pipeline reading source comments to pick it up. This finishes and relocates that work into the source tree as the durable source of truth: every LROT_FUNCENTRY'd lvgl.* constructor and every standalone lvgl utility function (set/show/hide/clear/build/ enable/disable/close/getScrollPos/isAppMode/isFullScreen/ exitFullScreen/getContext) now has a @function-style luadoc block matching the convention used throughout the rest of the Lua API, sourced from that original documentation and cross-checked against this file's actual current parameter handling on the 2.12 branch. Comment-only change, no behavior change (diff is 1024 pure additions, 0 deletions, 0 modified lines). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
The initial LVGL luadoc annotation commit captured several post-2.11.0 additions inline in individual @PARAM descriptions (filled/edited/values/align/borderPad/title-as-function) but never rolled them into the @status line, and consistently omitted the `floating` common-property's introduction version. Verified against actual EdgeTX commit/tag history (not the official guide's copy, which claims 2.11.6/2.11.4 for several of these) that `floating`, the SCROLL_xx constants + scrollBar/scrollDir/scrolled/ scrollTo, and lvgl.build's named type constants (lvgl.RECTANGLE etc.) were all first released in 2.12.0, not any 2.11.x version -- the official guide's version numbers for these predate the 2.12.0 tag cut and are stale relative to actual release history. Updates every affected function's @status line to name the specific version each field/capability was added in, following this codebase's existing convention (e.g. model.getInfo's "@status current Introduced in 2.0.6, changed in 2.2.0, filename added in 2.6.0, ..."). Adds the missing "(added in 2.12.0)" note to all 27 `floating` occurrences, and adds @notice/status coverage for box/page's scroll-related parameters and lvgl.build's type-constant parameter, which had no version note of any kind before this commit. Comment-only change, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
A prior commit on this branch "corrected" three version citations by checking `git tag --contains <commit>` against a single commit found on the main/2.12 line. That method is unreliable here because 2.11 is a maintained LTS branch that continued shipping point releases well after 2.12.0 (2.11.6 and 2.11.7 both released after 2.12.0) -- a feature can be backported to 2.11.x as a separate commit with a different SHA, which `git tag --contains` on the original commit would never find. Direct verification against the actual tagged trees (not single-commit ancestry) gives different answers: - `floating`: present on both 2.11.6 (LTS backport) and 2.12.0. Per convention, cite the lowest version number that supports a feature, not whichever shipped chronologically first -- so 2.11.6, not the previously-written 2.12.0. - `scrollBar`/`scrollDir`/`scrolled`/`scrollTo` on lvgl.box/lvgl.page: actually present since 2.11.2 (verified via git grep across each 2.11.x tag), not 2.12.0 as the prior commit claimed -- that claim wasn't even present in the original source material being ported. - lvgl.build's named type constants: present since 2.11.4, matching the original source material; the prior commit's "correction" to 2.12.0 was itself the error. Comment-only change, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
|
Follow-up: corrected 3 wrong version citations from the previous commit. The previous "version history" commit tried to verify a few citations by checking Direct verification against the actual tagged trees (
All three now cite the verified-correct, lowest-supporting version. Comment-only change, no behavior change. 🤖 Generated with Claude Code |
…arams The 9-line "common object properties" bullet list (x, y, w, h, color, pos, size, visible, floating) was repeated verbatim across all 27 widget-constructor luadoc comments in this file. A companion doc-pipeline change (JimB40/lua-reference-guide#7) adds @common/ @commonparams luadoc tags specifically to eliminate this: define the shared block once with @common, reference it from each widget with @commonparams, and the extractor splices it back in at build time -- so generated documentation is unchanged, but a future edit to a common property only needs to happen in one place. Verified: re-extracting and re-rendering this file's content with the new pipeline support produces output identical to before this refactor (only source line numbers and a generation timestamp differ, both expected side effects of inserting the new @common block). Comment-only change, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
|
Follow-up: deduplicated the repeated common-properties block via new pipeline support. The 9-line "common object properties" bullet list ( A companion PR to the docs-generation pipeline, ...referenced from each widget with: The extractor splices the named That pipeline PR also fixes a real, previously-undiscovered bug found while testing it against this branch's content: the extractor's Applied here: replaced all 27 duplicated blocks with 🤖 Generated with Claude Code |
An independent accuracy review checked every annotated function against the actual C++ implementation and the live official guide, and found: - lvgl.enable/disable/close: "Introduced in current" -> 2.11.0 (all three registered in the lvgl table since v2.11.0; simply undocumented on the official guide, hence no version to port) - lvgl.message: `details` param retyped function -> string, matching luaL_checkstring in LvglWidgetMessageDialog::parseParam - lvgl.switch: added the missing `filter` param (parsed in LvglWidgetSwitchPicker::parseParam, mirrors lvgl.source's filter) - lvgl.dialog: `flexPad` default corrected 0 -> PAD_OUTLINE, matching the shared LvglWidgetObject base member's actual default - lvgl.file: `maxLen` behavior corrected -- files over the limit are excluded from the list, not truncated for display - lvgl.page: explained the backButton/back/menu button coupling (backButton=true moves `back` to a second top-right button and repurposes the original button to call `menu`), added the missing PAGE-key mapping note, and fixed align's stated default (TOP -> VTOP, matching the enumerated alignment list and lvgl.box's page) - lvgl.set: signature corrected -- `parent` is a required argument, not optional as `[parent, ]params` implied - lvgl.arc: restored two dropped @notice lines (background arc visibility requires both bgColor and bgOpacity; opacity/rounded interaction is an LVGL rendering limitation) - lvgl.image: restored the dropped note that w/h are required (PERCENT_SIZE doesn't work for images) - 18 functions gated on fullscreenOnly (verified directly against luaLvglObjEx/luaLvglObj call sites, not the review's stated list -- correctly includes `dialog`, which the review missed despite it passing fullscreenOnly=true, and correctly excludes `menu`, which the review incorrectly included despite using the ungated luaLvglPopup path): added a consistent nil-return notice and retval wording across all of them, replacing the one-off "or nil" suffix that only `align` previously had - 7 functions with a `get` callback (choice, font, align, timer, switch, source, file -- verified via the shared ChoiceBase-derived UI class hierarchy each one's build() actually instantiates): corrected "called when the popup opens" to reflect that `get` runs on every refresh cycle, not once. `color` was excluded after verification (ColorPicker calls getValue() exactly once, in its constructor -- genuinely a one-shot call, unlike the ChoiceBase-family widgets); `menu` was also excluded (its build() calls getFunction exactly once at popup-open time, no refresh loop) Comment-only change, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
|
Follow-up: fixed 11 accuracy issues found by an independent review. A separate review pass checked every annotated function against the actual C++ implementation and the live official guide (https://luadoc.edgetx.org/2.11/lua-api-reference/lvgl-for-lua). Fixed all 11 findings, each re-verified against source before applying:
Comment-only change, no behavior change. 🤖 Generated with Claude Code |
An independent validation pass on the previous accuracy-fix commit found one regression and some polish items: - lvgl.file's `get` callback: the previous fix wrongly generalized this to "every refresh cycle" (true for the plain Choice-based pickers) but FileChoice routes `get` through getLabelText(), which only runs when the selection changes or on first open -- reverted to popup-open semantics, closer to correct. - lvgl.color's `get` callback: ColorPicker calls getValue() exactly once in its constructor, not on each popup open -- corrected to "called once when the object is created". - lvgl.image's PERCENT_SIZE claim: unsourced inference not present in the original guide or confirmed directly in source -- trimmed back to the sourced part of the notice (w/h are required). - lvgl.page's `back` parameter description: was misleading on its own (says "top-left button" unconditionally, only true when `backButton` is unset) -- reworded to be accurate standalone. - Missing blank line between @notice and @status in 6 blocks (button, toggle, textEdit, slider, verticalSlider, setting) -- every other notice-then-status block in this file, and all 42 in the other api_*.cpp files, use a blank line there; restored for consistency. Comment-only change, no behavior change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
|
Independent validation pass results, and a follow-up fix. Ran a second, fresh review (independent of the one that produced the previous fix commit) specifically to check those 11 fixes against source and confirm the two places where that pass overrode the original review's own findings. Results:
Also fixed in this pass: Comment-only change, no behavior change. Confirmed balanced comment delimiters and diff scope. 🤖 Generated with Claude Code |
Ported from #7 (docs/common-param-support): the four regexes anchored `^@tag` at true column 0, silently dropping any tag line indented to match surrounding code style. Found while investigating EdgeTX/edgetx#7771 (adds LVGL luadoc annotations, which are indented 2 spaces inside their LROT_BEGIN table) -- every one of that PR's ~45 functions was extracting zero parameters and "unknown" availability before this fix. Turns out this wasn't LVGL-specific: re-extracting the current 2.12 baseline with the fix (same 153 items, none added or lost) surfaced two real, silent bugs already live on this site -- model.getSwashRing's availability was "unknown" instead of "2.8.0", and playNumber was missing its `volume` parameter entirely. Both are fixed by this rebuild. Only the extraction-phase fix is ported here, not #7's build_outputs/ page-path changes -- that PR's branch was forked before this session's nested-URL restructure and generated-file-marker work, and its diff would have reverted both. The @common/@commonparams mechanism from that PR (needed for EdgeTX/edgetx#7771's shared LVGL parameter blocks) is included since it's purely additive at the extraction phase and independent of page-path/output concerns. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLXbKn4rY3NihRnqH89jmD
render_api_page collapsed every newline in a parameter or return description to a single space before writing it into the Markdown table cell, crushing any `* item` / `- item` bulleted settings list (a common convention in the upstream luadoc comments, e.g. "params (table): * x ... * y ...") into one unreadable run-on paragraph. Found while inspecting the @commonparams-expanded LVGL content from EdgeTX/edgetx#7771, but it turns out to affect plenty of already-live non-LVGL content too (loadScript's `mode` values, fstat's returned table shape, playNumber's `attributes`/`volume`, etc.) -- 6 items changed on re-extraction, 47 rendered files improved on rebuild. New render_table_cell_text() renders bullet lines as a real <ul><li> list (GFM tables allow raw inline HTML in cells, and this convention is already used elsewhere in this site's hand-authored pages); non-bullet lines are joined with <br> instead of a bare space. Also strips a leftover leading ":" that parse_param_or_retval_body left behind on "name (type): rest-of-description" lines (from the type's trailing colon), which was showing up as stray punctuation. Same 153 items in the model, same quality-report numbers -- this only changes how existing description text is rendered, not what was extracted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLXbKn4rY3NihRnqH89jmD
Re-extracted from EdgeTX/edgetx branch 2.12 at 8718d2473a (the squash merge of #7771, "add luadoc annotations for the LVGL Lua API"): 153 -> 198 items, all 45 real. The 44 hand-preserved flat lvgl-*.md pages (ported from the official guide, since firmware had zero LVGL annotations at all -- see prior HANDOFF.md entries) are replaced with real nested display-lvgl/<item>.md pages generated the same way as every other group now; the old flat files are removed, not left as orphans. Both #5 (the manual port) and #7 (the @common/@commonparams support this depended on, already ported separately) on JimB40/lua-reference-guide are closed as superseded by this. docs-system/generated/api-model.local.json, REAL-EXTRACTION-NOTES.md (both copies), and HANDOFF.md updated to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLXbKn4rY3NihRnqH89jmD
Summary
radio/src/lua/api_colorlcd_lvgl.cppimplements ~45 LVGL Lua bindings (buttons, sliders, labels, containers, dialogs, and other GUI controls for color-LCD scripts) but had zero/*luadoc*/annotations, so the Lua-reference-guide doc-generation pipeline could extract nothing for LVGL at all.The official EdgeTX Lua reference guide has long carried full, accurate LVGL documentation for this exact file — written by philmoz (GitHub handle
phil.a.mitchellin the docs repo's GitBook commit history), who also authored the large majority of this file's actual C++ bindings. That documentation lived only in the docs repo, completely disconnected from the source it describes, which is exactly what let it drift out of sync and made it impossible for any doc-generation pipeline reading source comments to pick it up.This PR finishes and relocates that work into the source tree as the durable source of truth: every
LROT_FUNCENTRY'dlvgl.*constructor (label, button, slider, box, page, dialog, etc.) and every standalonelvglutility function (set/show/hide/clear/build/enable/disable/close/getScrollPos/isAppMode/isFullScreen/exitFullScreen/getContext) now has a@function-style luadoc block matching the convention used throughout the rest of the Lua API (api_colorlcd.cpp,api_model.cpp,api_general.cpp).Targeted at the
2.12branch specifically (notmain) since that's the branch this documentation effort is scoped to, andmainhas ~40 additional LVGL-touching commits since v2.11.7 that aren't reflected here.Sourcing and verification
Primary source was a cleaned-up, already-structured port of the original GitBook content (parameter tables, defaults, notes) prepared in a companion docs-repo PR. Every function's parameter list and calling convention was cross-checked against this file's actual current C++ implementation on
2.12:luaLvglObjEx/luaLvglObj(lua_gettop(L) == 2check): every constructor takes an optional leadingparentobject plus aparamstable, usable either aslvgl.button([parent, ]params)orparent:button(params)OO-style.lvgl.clear()'s dual behavior (global UI clear vs. per-object child clear) directly fromluaLvglClear's implementation.lvgl.enable/lvgl.disable/lvgl.closehad no reliable version-history source (the ported content only had a generic placeholder version), so these are marked@status currentrather than a fabricated introduction version.press/longpress/checked, box'sflexFlow/borderPad, choice'sfilter/popupWidth) come from the ported content, which was itself already verified against firmware through v2.11.7 in the companion docs-repo task.Known limitation for reviewer attention: deep per-key verification against each individual
LvglWidget*class's internal property-parsing code (inlua_lvgl_widget.h/.cpp) was not performed for every one of the ~45 functions given the scope — the ported content (already through one round of firmware verification) was trusted for widget-specific settings, with verification focused on the shared calling-convention layer in this file. If any widget's actual accepted keys have drifted from what's documented, a review againstlua_lvgl_widget.hwould catch it.Test plan
/*/*/pairs confirmed (46 opens, 46 closes: 45 new blocks + the existing file-header copyright comment)/*or*/that could break comment nesting🤖 Generated with Claude Code
https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD
Follow-up (commit
04daca947c): the first commit captured several post-2.11.0 additions inline in@paramdescriptions but never rolled them into each function's@statusline, and consistently omitted thefloatingcommon-property's introduction version. Fixed, and along the way found that the official guide's version claims for several of these (floating: "2.11.6", SCROLL_xx constants andlvgl.build's named type constants: "2.11.4") don't match actual EdgeTX release history — verified viagit log -S+git tag --containsthat all of these were actually first released in 2.12.0, not any 2.11.x version. Updated@statuslines now name the specific version each field/capability was added in, matching this codebase's existing convention (e.g.model.getInfo's@status current Introduced in 2.0.6, changed in 2.2.0, filename added in 2.6.0, ...).🤖 Generated with Claude Code
https://claude.ai/code/session_015yCHydHbzZYCKpav38SonD