UI states + apiVersion detection for TOOLS script #288
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.
Adds UI states. This makes it easier to organise the code in
run_ui()and gives us more control over what is executed and when it's executed.There's three states:
initfor init stuff likeapiVersiondetectionmainMenufor the main menu codepagesfor page codeapiVersiondetection for TOOLS script is done by usingbackground.luafor now.It works by entering the
initstate when starting the script. It stays in this state until power is connected to the quad and it receives theapiVersion. If the quad is already powered this check only takes a second before it then moves onto themainMenustate. No pages are loaded until one is selected from the menu. Pages are unloaded when leaving thepagesstate.The TELEMETRY version works as before with
background.luadoingapiVersiondetection in the background.It's always forced topagesstate.EDIT: Added commit to allow detecting
apiVersionin init state for TELEMETRY script too. It's useful in those cases where the ui is brought on screen beforebackground.luais done with init. Doesn't use more memory since the memory use in init state is well below the peak memory use.currentState(renamed topageState) is now only used for pages.currentLineis renamed tocurrentFieldas that's a better description of what it actually is.Fixed
api/requiredVersioncheck for the main menu.I have tested this for a while now and haven't found anything that doesn't work like it should. Memory use is pretty much the same as it currently is.