My receivers (35MHz) usually go nuts when they loose radio signal.
If I turn OFF the TX the RX can turn the servos off limits and strip their gears, the motor can suddenly start...
Even in Waypoint mode I see that this happens, since you always have control over the servos from the IN-signal pins.
For testing purposes, and maybe in a situation were you loose signal, I want to programmatically turn ON the autopilot (WP-mode) and SHUT DOWN IN-signal 1-3.
I created a FORCE-WP-MODE flag which runs this in the main loop:
pinMode(1, OUTPUT); //CTRL
pinMode(4, OUTPUT); //MUX
digitalWrite(1, LOW); //CTRL - Shut down CTRL signal
digitalWrite(4, HIGH); //MUX - Turn on WP-mode
Also, In the read_Ch1() and read_Ch2() I return "0" if FORCE-WP-MODE flag is set to reject any random inputs.
Need to do some more testing, but It seems to work.
But I think I still saw some random noise when I connected the GPS. Need to check that again...
- Is there a better approach?
/Tommy
Replies
If I turn off the transmitter (or if the signals are weak) I can force the program in WP-mode with this code:
pinMode(4, OUTPUT); //MUX
digitalWrite(4, HIGH); //MUX - Turn on WP-mode
But I'm, still having problem to reject any random signal to the CTRL-pin. These signals sometimes reboot the program!
If I disconnect the CTRL-cable (ch#5) from the receiver - it works.
But, is there a way to code - so the (random) signals don’t affect the ardupilot?
/Tommy