diff --git a/Tools/scripts/build_options.py b/Tools/scripts/build_options.py index d34f3844cb..256d1d9694 100644 --- a/Tools/scripts/build_options.py +++ b/Tools/scripts/build_options.py @@ -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), diff --git a/Tools/scripts/extract_features.py b/Tools/scripts/extract_features.py index 61e670cc04..301b007c70 100755 --- a/Tools/scripts/extract_features.py +++ b/Tools/scripts/extract_features.py @@ -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'), diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 08268b3aee..bf0f4dd1f9 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -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); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 93b5ed45b7..7403acb39c 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -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 diff --git a/libraries/GCS_MAVLink/GCS_config.h b/libraries/GCS_MAVLink/GCS_config.h index 889a5c1448..2b981702f7 100644 --- a/libraries/GCS_MAVLink/GCS_config.h +++ b/libraries/GCS_MAVLink/GCS_config.h @@ -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 diff --git a/libraries/GCS_MAVLink/MissionItemProtocol.cpp b/libraries/GCS_MAVLink/MissionItemProtocol.cpp index 302f9dd833..d29faaa7f6 100644 --- a/libraries/GCS_MAVLink/MissionItemProtocol.cpp +++ b/libraries/GCS_MAVLink/MissionItemProtocol.cpp @@ -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() {