LUA: Mission Rotation - Up to 10 selectable missions via tx switch #28804
+206
−0
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 LUA script is an evolution on the MissionSelector.LUA.
Allows you to select up to 10 missions, either while arming or in the unarmed state.
It requires that an RCx_OPTION be set to a scripting value and must match the one inside the LUA.
The scripts should be installed in the SCRIPTS folder on the MicroSD, and the mission files in the root.
The mission file called mission0.txt (the default mission) must exist and is loaded at boot, if the script does not find it it stops working.
The other mission files should have the same name with only the number changed, from 1 to 9, example mission8.txt.
To load to the next mission file just bring AUX switch from low to high for no more than three seconds, each switch loads the next mission file in numerical order.
If the next mission file numerically does not exist load the next one, at the end of the rotation it returns to load mission0.txt.
If AUX is held at high state for more than three seconds the script will restart by loading mission0.txt.
If a mission switch is attempted in AUTO flight mode, a warning "Cannot switch missions in AUTO mode" will be shown and no operation will be performed.
If try to load the script and the flight mode is AUTO you will get a message “The script cannot be loaded in AUTO mode”
Provides for sending messages under any condition, load or error.
Classic example of use, i.e. how I usually use it:
In my case if any failsafe intervenes the chosen mission is then executed.
In this way by pre scheduling the appropriate missions for the location where I fly I can afford to handle any emergencies without using GCS, simply choosing with the script the most appropriate mission, and in case changing it on the fly.
Thanks to @IamPete1 for help on intercepting the vehicle type.
Of course, suggestions, corrections and implementations are welcome!