diff --git a/libraries/AP_Mission/AP_Mission.cpp b/libraries/AP_Mission/AP_Mission.cpp index d27beca79e9ca..3cc3fd85a14ef 100644 --- a/libraries/AP_Mission/AP_Mission.cpp +++ b/libraries/AP_Mission/AP_Mission.cpp @@ -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()) { @@ -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; @@ -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) {