-
Notifications
You must be signed in to change notification settings - Fork 373
Progressive settings loading - OSD tab loads much faster #2466
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
Progressive settings loading - OSD tab loads much faster #2466
Conversation
Changes Settings.processHtml to call its callback immediately instead of waiting for all settings to load. This allows tabs to start rendering while settings populate in the background. Key changes: - js/settings.js: configureInputs() now runs async, callback fires immediately for progressive rendering - tabs/osd.js: Added guards in updatePreviews(), updatePilotAndCraftNames(), and fillCustomElementsValues() to handle being called before data loads - tabs/osd.js: Call updatePilotAndCraftNames() from updateAll() to ensure it runs after OSD data is available This significantly improves perceived load time for tabs with many settings (e.g., OSD tab with 67+ settings).
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
Apply qodo-merge suggestion: check that customElementItems exists before entering the inner loop, not just the parent items[i] object.
The settingsPromise is now passed to the processHtml callback, allowing tabs to optionally await it if they need settings values immediately. Existing tabs work unchanged - they can simply ignore the parameter. Also reverts settingsCache.js to match original code structure.
- Remove premature loadOsdCustomElements() call during tab init (OSD.reload() already calls it in proper sequence) - Remove premature updatePilotAndCraftNames() call during tab init (already added to updateAll() in previous commit) - Remove explanatory comments (code is self-documenting)
… or master Replace semver version checks with runtime capability detection for loading logic conditions. This will allow a newer configurator to work with 9.0.0-RC1 firmware. ALso nightly firmware build from between 8 and 9. Always tries the optimized CONFIGURED mask path first (MSP2_INAV_LOGIC_CONDITIONS_CONFIGURED) Falls back to legacy path (fetch all 64) if: - Firmware returns unsupported/empty response - No response within 500ms timeout This approach removes hardcoded version checks (5.0.0, 9.0.0)
|
/review |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
User description
Summary
Makes OSD tab load significantly faster by allowing the page to render immediately while settings load in the background.
Previously the OSD tab waited for all 67+ settings to load sequentially before displaying anything. Now the UI appears instantly and settings populate as they arrive.
Changes
Settings.processHtmlnow calls callback immediately instead of waiting forconfigureInputs()to completeupdatePilotAndCraftNames()runs after OSD data is available viaupdateAll()Testing
Description
Optimize logic conditions loading with configured mask
Enable progressive settings loading for faster tab rendering
configureInputs()completesAdd safety guards in OSD tab functions
OSD.data,OSD.constants, and array items existenceMinor code cleanup and formatting improvements
Diagram Walkthrough
File Walkthrough
MSPHelper.js
Optimize logic conditions loading with maskjs/msp/MSPHelper.js
MSP2_INAV_LOGIC_CONDITIONS_CONFIGUREDmessage tostore 64-bit bitmask
loadLogicConditions()to use optimized path for firmware9.0.0+
configured conditions
conditions sequentially
settings.js
Enable progressive settings loadingjs/settings.js
processHtml()to call callback immediately instead of waitingfor
configureInputs()to completeconfigureInputs()now runs asynchronously in background withoutblocking page rendering
osd.js
Add safety guards for progressive loadingtabs/osd.js
updatePreviews()to check ifOSD.dataexists beforeprocessing
fillCustomElementsValues()to verify array items existbefore access
updatePilotAndCraftNames()to checkOSD.constantsandgeneralGroupinitializationupdatePilotAndCraftNames()call intoupdateAll()to ensure itruns after data loads
MSPCodes.js
Add logic conditions configured mask codejs/msp/MSPCodes.js
MSP2_INAV_LOGIC_CONDITIONS_CONFIGURED(0x203C) forfetching configured conditions mask
MSP2_INAV_LOGIC_CONDITIONS_SINGLEcodedefinition
settingsCache.js
Refactor settings cache retrievaljs/settingsCache.js
get()function to extract key into variable before uselettoconstfor immutable key variable