AP_Mission: add OPTIONS parameter
First option added now is to clear the mission on reboot Fixes #5743
This commit is contained in:
parent
a895d69b42
commit
46c982d64f
@ -22,6 +22,13 @@ const AP_Param::GroupInfo AP_Mission::var_info[] = {
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("RESTART", 1, AP_Mission, _restart, AP_MISSION_RESTART_DEFAULT),
|
||||
|
||||
// @Param: OPTIONS
|
||||
// @DisplayName: Mission options bitmask
|
||||
// @Description: Bitmask of what options to use in missions.
|
||||
// @Bitmask: 0:Clear Mission on reboot
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("OPTIONS", 2, AP_Mission, _options, AP_MISSION_OPTIONS_DEFAULT),
|
||||
|
||||
AP_GROUPEND
|
||||
};
|
||||
|
||||
@ -44,6 +51,12 @@ void AP_Mission::init()
|
||||
// changes in Content size break the storage
|
||||
static_assert(sizeof(union Content) == 12, "AP_Mission: Content must be 12 bytes");
|
||||
|
||||
// If Mission Clear bit is set then it should clear the mission, otherwise retain the mission.
|
||||
if (AP_MISSION_MASK_MISSION_CLEAR & _options) {
|
||||
gcs().send_text(MAV_SEVERITY_INFO, "Clearing Mission");
|
||||
clear();
|
||||
}
|
||||
|
||||
_last_change_time_ms = AP_HAL::millis();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,9 @@
|
||||
|
||||
#define AP_MISSION_RESTART_DEFAULT 0 // resume the mission from the last command run by default
|
||||
|
||||
#define AP_MISSION_OPTIONS_DEFAULT 0 // Do not clear the mission when rebooting
|
||||
#define AP_MISSION_MASK_MISSION_CLEAR (1<<0) // If set then Clear the mission on boot
|
||||
|
||||
/// @class AP_Mission
|
||||
/// @brief Object managing Mission
|
||||
class AP_Mission {
|
||||
@ -504,6 +507,7 @@ private:
|
||||
// parameters
|
||||
AP_Int16 _cmd_total; // total number of commands in the mission
|
||||
AP_Int8 _restart; // controls mission starting point when entering Auto mode (either restart from beginning of mission or resume from last command run)
|
||||
AP_Int16 _options; // bitmask options for missions, currently for mission clearing on reboot but can be expanded as required
|
||||
|
||||
// pointer to main program functions
|
||||
mission_cmd_fn_t _cmd_start_fn; // pointer to function which will be called when a new command is started
|
||||
|
Loading…
Reference in New Issue
Block a user