From fde1c061ed834a34c8da9e8e89eba32b070b8d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 18 May 2017 13:30:17 +0200 Subject: [PATCH] fix mavlink_mission: mission_set_current message only applies to MISSION_TYPE_MISSION and thus the current _mission_type does not matter. --- src/modules/mavlink/mavlink_mission.cpp | 29 +++++-------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/modules/mavlink/mavlink_mission.cpp b/src/modules/mavlink/mavlink_mission.cpp index 8d7fe70c69..f8fcb7f6cc 100644 --- a/src/modules/mavlink/mavlink_mission.cpp +++ b/src/modules/mavlink/mavlink_mission.cpp @@ -663,31 +663,14 @@ MavlinkMissionManager::handle_mission_set_current(const mavlink_message_t *msg) if (_state == MAVLINK_WPM_STATE_IDLE) { _time_last_recv = hrt_absolute_time(); - if (wpc.seq < current_item_count()) { - switch (_mission_type) { - case MAV_MISSION_TYPE_MISSION: - if (update_active_mission(_dataman_id, _count[(uint8_t)_mission_type], wpc.seq) == PX4_OK) { - if (_verbose) { PX4_INFO("WPM: MISSION_SET_CURRENT seq=%d OK", wpc.seq); } + if (wpc.seq < _count[(uint8_t)MAV_MISSION_TYPE_MISSION]) { + if (update_active_mission(_dataman_id, _count[(uint8_t)MAV_MISSION_TYPE_MISSION], wpc.seq) == PX4_OK) { + if (_verbose) { PX4_INFO("WPM: MISSION_SET_CURRENT seq=%d OK", wpc.seq); } - } else { - if (_verbose) { PX4_ERR("WPM: MISSION_SET_CURRENT seq=%d ERROR", wpc.seq); } + } else { + if (_verbose) { PX4_ERR("WPM: MISSION_SET_CURRENT seq=%d ERROR", wpc.seq); } - _mavlink->send_statustext_critical("WPM: WP CURR CMD: Error setting ID"); - } - - break; - - case MAV_MISSION_TYPE_FENCE: - update_geofence_count(_count[(uint8_t)_mission_type]); - break; - - case MAV_MISSION_TYPE_RALLY: - update_safepoint_count(_count[(uint8_t)_mission_type]); - break; - - default: - PX4_ERR("mission type %u not handled", (unsigned)_mission_type); - break; + _mavlink->send_statustext_critical("WPM: WP CURR CMD: Error setting ID"); } } else {