Copter: stop spray if changing a mode from ZigZag to other

This commit is contained in:
Tatsuya Yamaguchi 2020-02-02 22:07:58 +09:00 committed by Randy Mackay
parent 19d2ffcde7
commit 9f577a23c8

View File

@ -256,6 +256,13 @@ bool Copter::set_mode(Mode::Number mode, ModeReason reason)
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
exit_mode(flightmode, new_flightmode);