mirror of https://github.com/ArduPilot/ardupilot
AP_Mission: Added force resume for when MIS_RESTART=1
This commit is contained in:
parent
3b25a8ae2e
commit
d813a70c8d
|
@ -163,10 +163,11 @@ bool AP_Mission::starts_with_takeoff_cmd()
|
||||||
/// start_or_resume - if MIS_AUTORESTART=0 this will call resume(), otherwise it will call start()
|
/// start_or_resume - if MIS_AUTORESTART=0 this will call resume(), otherwise it will call start()
|
||||||
void AP_Mission::start_or_resume()
|
void AP_Mission::start_or_resume()
|
||||||
{
|
{
|
||||||
if (_restart) {
|
if (_restart == 1 && !_force_resume) {
|
||||||
start();
|
start();
|
||||||
} else {
|
} else {
|
||||||
resume();
|
resume();
|
||||||
|
_force_resume = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,7 @@ public:
|
||||||
_flags.nav_cmd_loaded = false;
|
_flags.nav_cmd_loaded = false;
|
||||||
_flags.do_cmd_loaded = false;
|
_flags.do_cmd_loaded = false;
|
||||||
_flags.in_landing_sequence = false;
|
_flags.in_landing_sequence = false;
|
||||||
|
_force_resume = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get singleton instance
|
// get singleton instance
|
||||||
|
@ -479,6 +480,9 @@ public:
|
||||||
// set in_landing_sequence flag
|
// set in_landing_sequence flag
|
||||||
void set_in_landing_sequence_flag(bool flag) { _flags.in_landing_sequence = flag; }
|
void set_in_landing_sequence_flag(bool flag) { _flags.in_landing_sequence = flag; }
|
||||||
|
|
||||||
|
// force mission to resume when start_or_resume() is called
|
||||||
|
void set_force_resume(bool force_resume) { _force_resume = force_resume; }
|
||||||
|
|
||||||
// get a reference to the AP_Mission semaphore, allowing an external caller to lock the
|
// get a reference to the AP_Mission semaphore, allowing an external caller to lock the
|
||||||
// storage while working with multiple waypoints
|
// storage while working with multiple waypoints
|
||||||
HAL_Semaphore &get_semaphore(void) {
|
HAL_Semaphore &get_semaphore(void) {
|
||||||
|
@ -582,6 +586,7 @@ private:
|
||||||
uint16_t _prev_nav_cmd_id; // id of the previous "navigation" command. (WAYPOINT, LOITER_TO_ALT, ect etc)
|
uint16_t _prev_nav_cmd_id; // id of the previous "navigation" command. (WAYPOINT, LOITER_TO_ALT, ect etc)
|
||||||
uint16_t _prev_nav_cmd_index; // index of the previous "navigation" command. Rarely used which is why we don't store the whole command
|
uint16_t _prev_nav_cmd_index; // index of the previous "navigation" command. Rarely used which is why we don't store the whole command
|
||||||
uint16_t _prev_nav_cmd_wp_index; // index of the previous "navigation" command that contains a waypoint. Rarely used which is why we don't store the whole command
|
uint16_t _prev_nav_cmd_wp_index; // index of the previous "navigation" command that contains a waypoint. Rarely used which is why we don't store the whole command
|
||||||
|
bool _force_resume; // when set true it forces mission to resume irrespective of MIS_RESTART param.
|
||||||
|
|
||||||
// jump related variables
|
// jump related variables
|
||||||
struct jump_tracking_struct {
|
struct jump_tracking_struct {
|
||||||
|
|
Loading…
Reference in New Issue