Ardupilot2/ArduPlane/mode_acro.cpp
Peter Barker f6cb1b5ad6 Plane: use a method on Mode for auto-navigation-mode
Avoids the state getting stale, which it will with a failed attempt to
go into qautotune, for example.
2021-01-10 16:04:30 +11:00

28 lines
625 B
C++

#include "mode.h"
#include "Plane.h"
bool ModeAcro::_enter()
{
plane.auto_throttle_mode = false;
plane.acro_state.locked_roll = false;
plane.acro_state.locked_pitch = false;
return true;
}
void ModeAcro::update()
{
// handle locked/unlocked control
if (plane.acro_state.locked_roll) {
plane.nav_roll_cd = plane.acro_state.locked_roll_err;
} else {
plane.nav_roll_cd = plane.ahrs.roll_sensor;
}
if (plane.acro_state.locked_pitch) {
plane.nav_pitch_cd = plane.acro_state.locked_pitch_cd;
} else {
plane.nav_pitch_cd = plane.ahrs.pitch_sensor;
}
}