Browse Source

AP_Mission: rearrange for early-exit if command not found for index

master
Peter Barker 7 years ago committed by Peter Barker
parent
commit
25282c2989
  1. 13
      libraries/AP_Mission/AP_Mission.cpp

13
libraries/AP_Mission/AP_Mission.cpp

@ -1554,15 +1554,16 @@ void AP_Mission::advance_current_do_cmd() @@ -1554,15 +1554,16 @@ void AP_Mission::advance_current_do_cmd()
// find next do command
Mission_Command cmd;
if (get_next_do_cmd(cmd_index, cmd)) {
// set current do command and start it
_do_cmd = cmd;
_flags.do_cmd_loaded = true;
start_command(_do_cmd);
}else{
if (!get_next_do_cmd(cmd_index, cmd)) {
// set flag to stop unnecessarily searching for do commands
_flags.do_cmd_all_done = true;
return;
}
// set current do command and start it
_do_cmd = cmd;
_flags.do_cmd_loaded = true;
start_command(_do_cmd);
}
/// get_next_cmd - gets next command found at or after start_index

Loading…
Cancel
Save