diff --git a/ArduCopterMega/Attitude.pde b/ArduCopterMega/Attitude.pde index 60d462ff59..a777125ad4 100644 --- a/ArduCopterMega/Attitude.pde +++ b/ArduCopterMega/Attitude.pde @@ -149,13 +149,18 @@ output_yaw_with_hold(boolean hold) long error = ((long)g.rc_4.control_in * 6) - rate; // control is += 6000 * 6 = 36000 // -error = CCW, +error = CW - if(g.rc_4.control_in == 0) - g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 3.0);// kP .07 * 36000 = 2520 - else - g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 1.0);// kP .07 * 36000 = 2520 + if(g.rc_4.control_in == 0){ + + // we are breaking; + g.rc_4.servo_out = (omega.z > 0) ? -1800 : 1800; + + }else{ + g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 1.0);// kP .07 * 36000 = 2520 + } g.rc_4.servo_out = constrain(g.rc_4.servo_out, -2400, 2400); // limit to 24° } + } // slight left rudder give right roll. diff --git a/ArduCopterMega/commands_logic.pde b/ArduCopterMega/commands_logic.pde index 12731a4365..f9bc937eba 100644 --- a/ArduCopterMega/commands_logic.pde +++ b/ArduCopterMega/commands_logic.pde @@ -75,7 +75,9 @@ handle_process_now() void handle_no_commands() { - if (command_must_ID) return; + if (command_must_ID) + return; + switch (control_mode){ case LAND: // don't get a new command @@ -85,7 +87,6 @@ handle_no_commands() // set_mode(LOITER); default: - if() set_mode(RTL); //next_command = get_LOITER_home_wp(); //SendDebug("MSG Preload RTL cmd id: ");