Plane: move defualt attitude control to base class

This commit is contained in:
Iampete1 2023-04-25 01:39:34 +01:00 committed by Andrew Tridgell
parent 6111e9d9db
commit 4ca071045c
3 changed files with 14 additions and 9 deletions

View File

@ -410,14 +410,7 @@ void Plane::stabilize()
}
#endif
} else {
// Direct stick mixing functionality has been removed, so as not to remove all stick mixing from the user completely
// the old direct option is now used to enable fbw mixing, this is easier than doing a param conversion.
if ((g.stick_mixing == StickMixing::FBW) || (g.stick_mixing == StickMixing::DIRECT_REMOVED)) {
stabilize_stick_mixing_fbw();
}
stabilize_roll();
stabilize_pitch();
stabilize_yaw();
plane.control_mode->run();
}
/*

View File

@ -200,3 +200,15 @@ bool Mode::_pre_arm_checks(size_t buflen, char *buffer) const
#endif
return true;
}
void Mode::run()
{
// Direct stick mixing functionality has been removed, so as not to remove all stick mixing from the user completely
// the old direct option is now used to enable fbw mixing, this is easier than doing a param conversion.
if ((plane.g.stick_mixing == StickMixing::FBW) || (plane.g.stick_mixing == StickMixing::DIRECT_REMOVED)) {
plane.stabilize_stick_mixing_fbw();
}
plane.stabilize_roll();
plane.stabilize_pitch();
plane.stabilize_yaw();
}

View File

@ -65,7 +65,7 @@ public:
void exit();
// run controllers specific to this mode
virtual void run() {};
virtual void run();
// returns a unique number specific to this mode
virtual Number mode_number() const = 0;