In the AUTO mode the failsafe function is:
> if (FAILSAFE_ACTION == 1){
set_mode(RTL);
throttle_cruise = THROTTLE_CRUISE;
So let's say if when switched to AUTO the plane now flies out of the RC Tx's range (out of sight too) en-route to waypoint #1 and the failsafe activates then the aircraft will RTL at cruise throttle. However when it comes back into range AUTO mode re-initializes and the plane attempts to fly back to waypoint #1, starting a loop which isn't desirable.
I don't know the code language but would like to have it so that RTL is locked after a failsafe condition until a certain radius from home is reached, then switched to normal RTL or to LOITER.
Can someone clued up on the code suggest the changes required to affect this?
Replies
OK, here is my code update for you...
what this does is override the resetting of the control mode back to Auto. If you loose connection in Auto, it will return home until you flip your control switch if your FAILSAFE_ACTION is set to 1.
enclosed is the file.
Jason
events.pde
Hi Graham,
Your right,
what we need to do is split the failsafe_event() to get a failsafe_event_on() and failsafe_event_off()
Then we can add that in. np. will have that for you today.
Jason
Have you tested this? i dont believe it would start the loop.
the reason being that the control channel is the only other thing that can change the mode. when it goes into failsafe the mode is changed in software, so long as the transmitter switch is not flicked it will remain in RTL.