Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions ArduCopter/mode_flip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,25 @@ bool ModeFlip::init(bool ignore_checks)
return false;
}

// if in acro or stabilize ensure throttle is above zero
if (copter.ap.throttle_zero && (copter.flightmode->mode_number() == Mode::Number::ACRO || copter.flightmode->mode_number() == Mode::Number::STABILIZE)) {
// only allow flip when flying
if (!motors->armed() || copter.ap.land_complete) {
return false;
}

// ensure roll input is less than 40deg
if (abs(channel_roll->get_control_in()) >= 4000) {
return false;
// if in acro or stabilize ensure throttle is above zero
if (copter.ap.throttle_zero) {
switch (copter.flightmode->mode_number()) {
case Mode::Number::ACRO:
case Mode::Number::STABILIZE:
return false;

default:
break;
}
}

// only allow flip when flying
if (!motors->armed() || copter.ap.land_complete) {
// ensure roll and pitch input is less than 40deg
if ((abs(channel_roll->get_control_in()) >= 4000) || (abs(channel_pitch->get_control_in()) >= 4000)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ((abs(channel_roll->get_control_in()) >= 4000) || (abs(channel_pitch->get_control_in()) >= 4000)) {
if ((abs(channel_roll->get_control_in()) >= 4000) ||
(abs(channel_pitch->get_control_in()) >= 4000)) {

return false;
}

Expand Down
Loading