Browse Source

Copter: cancel takeoff if mode changed

master
Randy Mackay 10 years ago
parent
commit
772a1acc37
  1. 5
      ArduCopter/flight_mode.pde
  2. 7
      ArduCopter/takeoff.pde

5
ArduCopter/flight_mode.pde

@ -234,7 +234,10 @@ static void exit_mode(uint8_t old_control_mode, uint8_t new_control_mode) @@ -234,7 +234,10 @@ static void exit_mode(uint8_t old_control_mode, uint8_t new_control_mode)
// this assumes all manual flight modes use get_pilot_desired_throttle to translate pilot input to output throttle
set_accel_throttle_I_from_pilot_throttle(get_pilot_desired_throttle(g.rc_3.control_in));
}
// cancel any takeoffs in progress
takeoff_stop();
#if FRAME_CONFIG == HELI_FRAME
// firmly reset the flybar passthrough to false when exiting acro mode.
if (old_control_mode == ACRO) {

7
ArduCopter/takeoff.pde

@ -61,6 +61,13 @@ static void takeoff_timer_start(float alt) @@ -61,6 +61,13 @@ static void takeoff_timer_start(float alt)
takeoff_state.time_ms = (alt/takeoff_state.speed) * 1.0e3f;
}
// stop takeoff
static void takeoff_stop()
{
takeoff_state.running = false;
takeoff_state.start_ms = 0;
}
// update takeoff timer and stop the takeoff after time_ms has passed
static void takeoff_timer_update()
{

Loading…
Cancel
Save