-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Use live cfg json instead of file for usermod settings page #4609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Part of the ongoing quest to migrate macro definitions to typed language constructs. This actually yields a small improvement in code size, likely from the byte->int conversion.
Break the actual JSON assembly apart from the file writing code. This permits calling it in other contexts, allowing us to pull the live config data even if the filesystem is out of date.
Clarify the name and usage of this flag, as the function name has changed out from underneath it.
Rather than reading the file off disk, have the json/cfg endpoint return the live config from system state data. This can improve UI behaviour as it can never be out of date or include values that do not apply to the current firmware install.
Use json/cfg for the usermod settings page. Should fix issues with outdated content when a new firmware is loaded.
WalkthroughThe changes refactor the configuration serialization process and update variable names across several modules. The primary adjustment is the renaming of the serialization function from Changes
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (11)
🧰 Additional context used🧬 Code Definitions (2)wled00/improv.cpp (2)
wled00/wled.cpp (2)
⏰ Context from checks skipped due to timeout of 90000ms (5)
🔇 Additional comments (20)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
One thing of note: The original idea for settings rewrite was to abandon config processing using cfg.cpp/xml.cpp and rely on cfg.json parsing in JavaScript. Usermod setting page was the first implementation of that but further development stalled as @Aircoookie couldn't find time to do it. AFAIK /json/cfg was intended to allow WLED configuration from external sources like LedFx or xLights, etc. |
Parsing the configuration JSON directly in the settings pages is a good idea. The difference here is only in the source: this PR changes it to come from the live memory state, instead of whatever was last written to the filesystem. Any existing code need only point to |
blazoncek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved from my side.
Neither the info panel nor the settings dialog can be trusted to accurately report the usermod list: - Not all usermods necessarily add to the info panel - Not all usermods necessarily add to the config page - wled#4609 is required for the config page to be correct Add a short list to the info object that lists the loaded usermod IDs. This is not displayed via the UI, but can be queried with curl or web debug tools. To be removed when usermod loading is working well.
Ensure that the usermods settings page is using a correct and complete set of configuration items for the currently loaded firmware, regardless of what may have been left behind in
cfg.jsonfrom previous firmware installs.Implemented by:
json/cfgendpoint uses live constructed JSON output instead of returning the disk file;json/cfginstead.Reference: #4597
Summary by CodeRabbit