From 55c342c85800bfcc3f4b0aeac47b50dc708f944d Mon Sep 17 00:00:00 2001 From: Jason Short Date: Fri, 20 Jul 2012 16:47:05 -0700 Subject: [PATCH] ACM: Safety patch for CH7 flip toggle. Prevents flipping while on the ground. ouch. --- ArduCopter/control_modes.pde | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ArduCopter/control_modes.pde b/ArduCopter/control_modes.pde index 09b13c7a03..44c1a581dd 100644 --- a/ArduCopter/control_modes.pde +++ b/ArduCopter/control_modes.pde @@ -73,10 +73,22 @@ static void read_trim_switch() do_simple = (g.rc_7.radio_in > CH_7_PWM_TRIGGER); }else if (g.ch7_option == CH7_FLIP){ - if (g.rc_7.radio_in > CH_7_PWM_TRIGGER && takeoff_complete && g.rc_3.control_in != 0){ - if(do_flip == false) + if (trim_flag == false && g.rc_7.radio_in > CH_7_PWM_TRIGGER){ + trim_flag = true; + + // don't flip if we accidentally engaged flip, but didn't notice and tried to takeoff + if(g.rc_3.control_in != 0 && takeoff_complete){ init_flip(); + } } + if (trim_flag == true && g.rc_7.control_in < 800){ + trim_flag = false; + } + + //if (g.rc_7.radio_in > CH_7_PWM_TRIGGER && takeoff_complete && g.rc_3.control_in != 0){ + // if(do_flip == false) + // init_flip(); + //} }else if (g.ch7_option == CH7_RTL){ if (trim_flag == false && g.rc_7.radio_in > CH_7_PWM_TRIGGER){