Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_Mission: get_item: ensure returned item is clean #29038

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions libraries/AP_Mission/AP_Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ bool AP_Mission::set_item(uint16_t index, mavlink_mission_item_int_t& src_packet

bool AP_Mission::get_item(uint16_t index, mavlink_mission_item_int_t& ret_packet) const
{
mavlink_mission_item_int_t tmp;
mavlink_mission_item_int_t tmp {};

// can't handle request for anything bigger than the mission size...
if (index >= num_commands()) {
Expand Down Expand Up @@ -760,7 +760,7 @@ bool AP_Mission::get_item(uint16_t index, mavlink_mission_item_int_t& ret_packet
tmp.current = 0;
}

// set auto continue to 1, becasue that's what's done elsewhere.
// set auto continue to 1, because that's what's done elsewhere.
tmp.autocontinue = 1; // 1 (true), 0 (false)
tmp.command = cmd.id;

Expand Down Expand Up @@ -1577,12 +1577,19 @@ bool AP_Mission::mission_cmd_to_mavlink_int(const AP_Mission::Mission_Command& c

// set defaults
packet.current = 0; // 1 if we are passing back the mission command that is currently being executed
packet.frame = 0;
packet.autocontinue = 1;

// Strictly these should be defaulted to NaN
packet.param1 = 0;
packet.param2 = 0;
packet.param3 = 0;
packet.param4 = 0;
packet.frame = 0;
packet.autocontinue = 1;

// Strictly these should be defaulted to INT32_MAX for x and y and NaN for z
packet.x = 0;
packet.y = 0;
packet.z = 0;

// command specific conversions from mission command to mavlink packet
switch (cmd.id) {
Expand Down
Loading