Sure, the easiest way to add a new switch is to take as a baseline an other switch; for example, the kill switch.
Almost everything you need to change is in the
rc_update module (this is a new module, you need to pull the latest master to find it, previously everything was in the sensor module).
Take for example this line: https://github.com/PX4/Firmware/blob/4a28c8180b3f0249efc706f712b9ed41ca4f7dec/src/modules/rc_update/rc_update.cpp#L446-L447
Duplicate it, change
rc_killswitch_inv as well.
Then you need to search where the previous variables should be declared and associated to a parameter (note that
RC_CHANNELS_FUNCTION_TERMINATION has to be added in the message definition: https://github.com/PX4/Firmware/blob/07d656e971a72d1202651dfd3b4642736fb078d7/msg/rc_channels.msg).
After this is done, you can simply go to commander and make the change you made previously, but using the newly created termination switch.
There shouldn’t be anything too complicated, just search, copy/paste, replace, compile, fix the missing declarations and repeat.
I hope it’s clear enough, don’t hesitate to ask if there is an issue you can’t solve.