fix mavlink_mission: mission_set_current message only applies to MISSION_TYPE_MISSION

and thus the current _mission_type does not matter.
This commit is contained in:
Beat Küng 2017-05-18 13:30:17 +02:00 committed by Lorenz Meier
parent 6d85a3c4e4
commit fde1c061ed
1 changed files with 6 additions and 23 deletions

View File

@ -663,10 +663,8 @@ 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 (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 {
@ -675,21 +673,6 @@ MavlinkMissionManager::handle_mission_set_current(const mavlink_message_t *msg)
_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;
}
} else {
if (_verbose) { PX4_ERR("WPM: MISSION_SET_CURRENT seq=%d ERROR: not in list", wpc.seq); }