fix(color): modifying model labels may corrupt model yaml files - #7709
Merged
Conversation
pfeerick
reviewed
Aug 26, 2026
Covers the moduleData/header YAML node layout introduced for PartialModel, cross-checks PartialModel and ModelData parse the same header YAML identically, and locks in the header.labels CSV-capacity contract that LABELS_LENGTH-1 (not LABEL_LENGTH-1) is meant to guarantee. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
header.labels only exists on color targets that define STORAGE_MODELSLIST; guard the label-related assertions accordingly. Didn't check black & white targets before the previous push, which broke CI across the board. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pfeerick
added a commit
that referenced
this pull request
Aug 26, 2026
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> (cherry picked from commit 35662d0)
This was referenced Aug 26, 2026
pfeerick
added a commit
that referenced
this pull request
Aug 26, 2026
- Move clearUserData() out of the #if COLORLCD guard in applyDefaultTemplate() - the userData feature and Lua API are not COLORLCD-only, so B&W radios were never getting a clean model reset. - Fix getAllUserData(app)'s arg-count check: >= 2 meant the documented one-argument form silently returned every entry instead of filtering by app. The cross-model corruption fix (guarding the userdata YAML callbacks and clearUserData() on the buffer being &g_model) that was here earlier is no longer needed: PR #7709 removed the only call sites that read a full ModelData buffer for a model other than g_model (storage/modelslist.cpp's label scans now use the header-only PartialModel, which has no userData node), so the corruption path is now structurally unreachable.
2 tasks
pfeerick
added a commit
that referenced
this pull request
Aug 28, 2026
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> (cherry picked from commit 35662d0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The change to make the model screens and widget data dynamic missed the fact that changing model labels causes reading and writing of model YAML files other than the currently loaded model.
Introduced in #6782
This is handled by dynamically allocating a ModelData buffer to read into and write from.
However the model screen and widget data no longer lives in the ModelData structure; but in global variables.
When reading other model files to update the labels, this would overwrite the screen and widget data for the currently active model. This data could then be written back to the active model file overwriting the correct settings.
It is currently not possible to store the screen and widget data in the ModelData structure as the system that generates the firmware YAML parser can only handle simple data types.
To avoid creating and managing even more temporary buffers this PR changes the logic for updating labels.
Changes:
This removes the need for dynamically allocated ModelData buffers (the PartialModel buffers are very small and live on the stack).
It reduces the overhead by not reading the entire model yaml just to get the labels from the header section.
It no longer touches any of the active model data structures.