GCS_MAVLink: add build option for deprecated MISSION_REQUEST

replaced by MISSION_REQUEST_INT
This commit is contained in:
Peter Barker 2023-10-12 17:35:00 +11:00 committed by Andrew Tridgell
parent fa31a5e838
commit 90d39a6ee0
6 changed files with 19 additions and 1 deletions

View File

@ -308,6 +308,7 @@ BUILD_OPTIONS = [
Feature('MAVLink', 'AP_MAVLINK_MSG_DEVICE_OP_ENABLED', 'AP_MAVLINK_MSG_DEVICE_OP_ENABLED', 'Enable handling of DeviceOp mavlink messages', 0, None), # noqa
Feature('MAVLink', 'AP_MAVLINK_SERVO_RELAY_ENABLED', 'AP_MAVLINK_SERVO_RELAY_ENABLED', 'Enable handling of ServoRelay mavlink messages', 0, 'SERVORELAY_EVENTS'), # noqa
Feature('MAVLink', 'AP_MAVLINK_MSG_SERIAL_CONTROL_ENABLED', 'AP_MAVLINK_MSG_SERIAL_CONTROL_ENABLED', 'Enable handling of Serial Control mavlink messages', 0, None), # noqa
Feature('MAVLink', 'AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED', 'AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED', 'Enable handling of MISSION_REQUEST mavlink messages', 0, None), # noqa
Feature('Developer', 'KILL_IMU', 'AP_INERTIALSENSOR_KILL_IMU_ENABLED', 'Allow IMUs to be disabled at runtime', 0, None),
Feature('Developer', 'CRASHCATCHER', 'AP_CRASHDUMP_ENABLED', 'Enable CrashCatcher', 0, None),

View File

@ -219,7 +219,7 @@ class ExtractFeatures(object):
('AP_MAVLINK_MSG_DEVICE_OP_ENABLED', 'GCS_MAVLINK::handle_device_op_write'),
('AP_MAVLINK_SERVO_RELAY_ENABLED', 'GCS_MAVLINK::handle_servorelay_message'),
('AP_MAVLINK_MSG_SERIAL_CONTROL_ENABLED', 'GCS_MAVLINK::handle_serial_control'),
('AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED', 'GCS_MAVLINK::handle_mission_request\b'),
('AP_DRONECAN_HIMARK_SERVO_SUPPORT', 'AP_DroneCAN::SRV_send_himark'),
('AP_DRONECAN_HOBBYWING_ESC_SUPPORT', 'AP_DroneCAN::hobbywing_ESC_update'),
('COMPASS_CAL_ENABLED', 'CompassCalibrator::stop'),

View File

@ -525,7 +525,9 @@ protected:
MAV_RESULT handle_command_do_aux_function(const mavlink_command_int_t &packet);
MAV_RESULT handle_command_storage_format(const mavlink_command_int_t &packet, const mavlink_message_t &msg);
void handle_mission_request_list(const mavlink_message_t &msg);
#if AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED
void handle_mission_request(const mavlink_message_t &msg);
#endif
void handle_mission_request_int(const mavlink_message_t &msg);
void handle_mission_clear_all(const mavlink_message_t &msg);

View File

@ -608,6 +608,7 @@ void GCS_MAVLINK::handle_mission_request_int(const mavlink_message_t &msg)
prot->handle_mission_request_int(*this, packet, msg);
}
#if AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED
void GCS_MAVLINK::handle_mission_request(const mavlink_message_t &msg)
{
// decode
@ -620,6 +621,7 @@ void GCS_MAVLINK::handle_mission_request(const mavlink_message_t &msg)
}
prot->handle_mission_request(*this, packet, msg);
}
#endif
// returns a MISSION_STATE numeration value best describing out
// current mission state.
@ -4179,9 +4181,12 @@ void GCS_MAVLINK::handle_common_mission_message(const mavlink_message_t &msg)
case MAVLINK_MSG_ID_MISSION_REQUEST_INT:
handle_mission_request_int(msg);
break;
#if AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED
case MAVLINK_MSG_ID_MISSION_REQUEST:
handle_mission_request(msg);
break;
#endif
#if AP_MAVLINK_MISSION_SET_CURRENT_ENABLED
case MAVLINK_MSG_ID_MISSION_SET_CURRENT: // MAV ID: 41

View File

@ -78,3 +78,11 @@
#ifndef AP_MAVLINK_MSG_SERIAL_CONTROL_ENABLED
#define AP_MAVLINK_MSG_SERIAL_CONTROL_ENABLED HAL_GCS_ENABLED
#endif
// GCS should be using MISSION_REQUEST_INT instead; this is a waste of
// flash. MISSION_REQUEST was deprecated in June 2020. We started
// sending warnings to the GCS in Sep 2022 if this command was used.
// Copter 4.4.0 sends this warning.
#ifndef AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED
#define AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED 1
#endif

View File

@ -159,6 +159,7 @@ void MissionItemProtocol::handle_mission_request_int(GCS_MAVLINK &_link,
_link.send_message(MAVLINK_MSG_ID_MISSION_ITEM_INT, (const char*)&ret_packet);
}
#if AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED
void MissionItemProtocol::handle_mission_request(GCS_MAVLINK &_link,
const mavlink_mission_request_t &packet,
const mavlink_message_t &msg
@ -202,6 +203,7 @@ void MissionItemProtocol::handle_mission_request(GCS_MAVLINK &_link,
// buffer space is checked by send_message
_link.send_message(MAVLINK_MSG_ID_MISSION_ITEM, (const char*)&ret_packet);
}
#endif // AP_MAVLINK_MSG_MISSION_REQUEST_ENABLED
void MissionItemProtocol::send_mission_item_warning()
{