Change fallback mode from OFFBOARD

When Offboard mode is rejected (commanded by a switch on the RC control), PX4 falls back to Altitude mode (I have no GPS, maybe it would be Position mode then). I would like to change the code so that if Offboard is rejected, the flight mode falls back to the previously active mode (or Manual, as I will always go into Offboard from Manual) instead of Altitude.

I tried to find the right lines in commander.cpp and state_machine_helper.cpp but I do not manage to get it changed correctly. Thanks for your help!