Browse Source

AP_Mission: loop check is only needed in one place

mission-4.1.18
Andrew Tridgell 10 years ago
parent
commit
3d433d2106
  1. 8
      libraries/AP_Mission/AP_Mission.cpp

8
libraries/AP_Mission/AP_Mission.cpp

@ -1002,8 +1002,7 @@ bool AP_Mission::advance_current_nav_cmd()
} }
// search until we find next nav command or reach end of command list // search until we find next nav command or reach end of command list
uint8_t max_loops = 64; while (!_flags.nav_cmd_loaded) {
while (!_flags.nav_cmd_loaded && --max_loops) {
// get next command // get next command
if (!get_next_cmd(cmd_index, cmd, true)) { if (!get_next_cmd(cmd_index, cmd, true)) {
return false; return false;
@ -1029,11 +1028,6 @@ bool AP_Mission::advance_current_nav_cmd()
cmd_index = cmd.index+1; cmd_index = cmd.index+1;
} }
if (max_loops == 0) {
// the mission is looping
return false;
}
// if we got this far we must have successfully advanced the nav command // if we got this far we must have successfully advanced the nav command
return true; return true;
} }

Loading…
Cancel
Save