From 402be4eacabae73337cebc5683afa0c397dc504e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 30 Jan 2019 20:20:20 +1100 Subject: [PATCH] AP_Mission: const writing of commands to storage --- libraries/AP_Mission/AP_Mission.cpp | 4 ++-- libraries/AP_Mission/AP_Mission.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Mission/AP_Mission.cpp b/libraries/AP_Mission/AP_Mission.cpp index 40b69877bd..90496b546e 100644 --- a/libraries/AP_Mission/AP_Mission.cpp +++ b/libraries/AP_Mission/AP_Mission.cpp @@ -320,7 +320,7 @@ bool AP_Mission::add_cmd(Mission_Command& cmd) /// replace_cmd - replaces the command at position 'index' in the command list with the provided cmd /// replacing the current active command will have no effect until the command is restarted /// returns true if successfully replaced, false on failure -bool AP_Mission::replace_cmd(uint16_t index, Mission_Command& cmd) +bool AP_Mission::replace_cmd(uint16_t index, const Mission_Command& cmd) { // sanity check index if (index >= (unsigned)_cmd_total) { @@ -586,7 +586,7 @@ bool AP_Mission::stored_in_location(uint16_t id) /// write_cmd_to_storage - write a command to storage /// index is used to calculate the storage location /// true is returned if successful -bool AP_Mission::write_cmd_to_storage(uint16_t index, Mission_Command& cmd) +bool AP_Mission::write_cmd_to_storage(uint16_t index, const Mission_Command& cmd) { WITH_SEMAPHORE(_rsem); diff --git a/libraries/AP_Mission/AP_Mission.h b/libraries/AP_Mission/AP_Mission.h index d67080d473..3c0ace793b 100644 --- a/libraries/AP_Mission/AP_Mission.h +++ b/libraries/AP_Mission/AP_Mission.h @@ -381,7 +381,7 @@ public: /// replace_cmd - replaces the command at position 'index' in the command list with the provided cmd /// replacing the current active command will have no effect until the command is restarted /// returns true if successfully replaced, false on failure - bool replace_cmd(uint16_t index, Mission_Command& cmd); + bool replace_cmd(uint16_t index, const Mission_Command& cmd); /// is_nav_cmd - returns true if the command's id is a "navigation" command, false if "do" or "conditional" command static bool is_nav_cmd(const Mission_Command& cmd); @@ -433,7 +433,7 @@ public: /// write_cmd_to_storage - write a command to storage /// cmd.index is used to calculate the storage location /// true is returned if successful - bool write_cmd_to_storage(uint16_t index, Mission_Command& cmd); + bool write_cmd_to_storage(uint16_t index, const Mission_Command& cmd); /// write_home_to_storage - writes the special purpose cmd 0 (home) to storage /// home is taken directly from ahrs