Ok first off, I did this quite a while ago, but hopefully I can still help. There are several things you have to do. Also this is in no particular order, its just as I remember.
This one is mostly up to you to implement. Essentially just make a controller for your flight mode. It’s probably a good idea to start it by copying one of the existing flightmodes.
Set up some enums that will be used
k_mode_my_flightmode = aNumberThatMakesSense, to the big
The other flight modes are also defined here, so you can look to them for guidance.
MY_FLIGHTMODE = aNumThatMakesSense to the
I just added mine as the last element in the enum and gave it a value of 21
add prototypes for 2 methods concerning your flightmode. Can realistically put anywhere, but probably better convention to put near another flightmode.
Should look like :
I added my flight mode to switch statements in side of the
Just look at the existing cases, copy, and modify them for your flightmode. These will use the enums you set in defines.h
add a case to the
handle_jsbutton_press method. Again just look to the cases for other flight modes when writing yours. This will use both the enums you added (
Okay, well that’s about all I can think of right now. If it doesn’t work, the error messages from compiler can be quite useful.
I guess I should mention that mavproxy wont recognize the name of your mode, so in order to switch to it you will have to use the mavproxy command
mode theNumberOfMyFlightMode where theNumberOfMyFlightMode is whatever number you set
MY_FLIGHTMODE to in
If you want your flightmode to appear in QGC, you have to modify and build it if you want it to recognize your flightmode and say the name when you swap and all that.
Hope this helps!