Hide GPS settings if unavailable #495
Merged
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.
This is an improvement over #480 to also check for availability of GPS, not only the VTX. The current mechanism used for checking availability of features has been refactored so that the implementation is more straightforward and easier to extend to support checking for more features in the future (immediately comes to mind OSD and Blackbox; e.g. some AIO boards do not have flash chip). This use-case was mentioned in this comment on the past PR.
However there is an apparent bottleneck when we try to extend this mechanism for showing supported settings pages only. With this we want to avoid confusion and save time for the user; less scrolling and no need to select a page just to find it's not available. Currently we send one MSP command to check availability of each feature, thus increasing the initialization time significantly which ultimately defeats the purpose.
My proposal for a more robust solution is to implement a new MSP command in firmware (say called
MSP2_BUILD_CONFIG
) which would return the supported features as bit flags (1 or 2 bytes) in a single roundtrip. This would also allow us to postpone VTX Table downloading as well, and do it when the user selects the VTX page (only when it's available). At the end of the day the user may just want to change PIDs and so no point in waiting for VTX Table download on init unconditionally.For these reasons I'm making this PR a draft and open for discussion.