mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 00:04:02 -04:00
Copter: move zigzag exit into mode_zigzag.cpp
This commit is contained in:
parent
ab557662cc
commit
735498e160
@ -256,13 +256,6 @@ bool Copter::set_mode(Mode::Number mode, ModeReason reason)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MODE_ZIGZAG_ENABLED == ENABLED && SPRAYER_ENABLED == ENABLED
|
|
||||||
// The pump will stop if the flight mode is changed from ZigZag to other
|
|
||||||
if (control_mode == Mode::Number::ZIGZAG && g2.zigzag_auto_pump_enabled) {
|
|
||||||
copter.sprayer.run(false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// perform any cleanup required by previous flight mode
|
// perform any cleanup required by previous flight mode
|
||||||
exit_mode(flightmode, new_flightmode);
|
exit_mode(flightmode, new_flightmode);
|
||||||
|
|
||||||
@ -363,6 +356,12 @@ void Copter::exit_mode(Mode *&old_flightmode,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MODE_ZIGZAG_ENABLED == ENABLED
|
||||||
|
if (old_flightmode == &mode_zigzag) {
|
||||||
|
mode_zigzag.exit();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FRAME_CONFIG == HELI_FRAME
|
#if FRAME_CONFIG == HELI_FRAME
|
||||||
// firmly reset the flybar passthrough to false when exiting acro mode.
|
// firmly reset the flybar passthrough to false when exiting acro mode.
|
||||||
if (old_flightmode == &mode_acro) {
|
if (old_flightmode == &mode_acro) {
|
||||||
|
@ -1388,6 +1388,7 @@ public:
|
|||||||
using Mode::Mode;
|
using Mode::Mode;
|
||||||
|
|
||||||
bool init(bool ignore_checks) override;
|
bool init(bool ignore_checks) override;
|
||||||
|
void exit();
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
bool requires_GPS() const override { return true; }
|
bool requires_GPS() const override { return true; }
|
||||||
|
@ -41,6 +41,17 @@ bool ModeZigZag::init(bool ignore_checks)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// perform cleanup required when leaving zigzag mode
|
||||||
|
void ModeZigZag::exit()
|
||||||
|
{
|
||||||
|
#if SPRAYER_ENABLED == ENABLED
|
||||||
|
// The pump will stop if the flight mode is changed from ZigZag to other
|
||||||
|
if (g2.zigzag_auto_pump_enabled) {
|
||||||
|
copter.sprayer.run(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// run the zigzag controller
|
// run the zigzag controller
|
||||||
// should be called at 100hz or more
|
// should be called at 100hz or more
|
||||||
void ModeZigZag::run()
|
void ModeZigZag::run()
|
||||||
|
Loading…
Reference in New Issue
Block a user