Browse Source

AP_Mission: Change jump_to_landing_sequence to get_landing_sequence_start

mission-4.1.18
Michael Day 11 years ago committed by Andrew Tridgell
parent
commit
83c2f497a3
  1. 15
      libraries/AP_Mission/AP_Mission.cpp
  2. 5
      libraries/AP_Mission/AP_Mission.h

15
libraries/AP_Mission/AP_Mission.cpp

@ -1241,16 +1241,17 @@ uint16_t AP_Mission::num_commands_max(void) const
} }
// find the nearest landing sequence starting point (DO_LAND_START) and // find the nearest landing sequence starting point (DO_LAND_START) and
// switch to that mission item. // return its index. Returns 0 if no appropriate DO_LAND_START point can
bool AP_Mission::jump_to_landing_sequence() // be found.
uint16_t AP_Mission::get_landing_sequence_start()
{ {
struct Location current_loc; struct Location current_loc;
if (!_ahrs.get_position(current_loc)) { if (!_ahrs.get_position(current_loc)) {
return false; return 0;
} }
int16_t landing_start_index = -1; uint16_t landing_start_index = 0;
float min_distance = -1; float min_distance = -1;
// Go through mission looking for nearest landing start command // Go through mission looking for nearest landing start command
@ -1268,10 +1269,6 @@ bool AP_Mission::jump_to_landing_sequence()
} }
} }
if (landing_start_index == -1) { return landing_start_index;
return false;
}
return set_current_cmd(landing_start_index);
} }

5
libraries/AP_Mission/AP_Mission.h

@ -321,8 +321,9 @@ public:
uint32_t last_change_time_ms(void) const { return _last_change_time_ms; } uint32_t last_change_time_ms(void) const { return _last_change_time_ms; }
// find the nearest landing sequence starting point (DO_LAND_START) and // find the nearest landing sequence starting point (DO_LAND_START) and
// switch to that mission item. // return its index. Returns 0 if no appropriate DO_LAND_START point can
bool jump_to_landing_sequence(); // be found.
uint16_t get_landing_sequence_start();
// user settable parameters // user settable parameters
static const struct AP_Param::GroupInfo var_info[]; static const struct AP_Param::GroupInfo var_info[];

Loading…
Cancel
Save