From db714c2e9b00115d55dd439b7d5de37b667bc75f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 31 Jul 2017 09:42:42 +0200 Subject: [PATCH] Start plan request: Wait until the protocol version is definite. --- src/Vehicle/Vehicle.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 3f1ce0e5c..5f36ed5c6 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -821,6 +821,11 @@ void Vehicle::_setMaxProtoVersion(unsigned version) { if (_maxProtoVersion == 0 || version < _maxProtoVersion) { _maxProtoVersion = version; emit requestProtocolVersion(_maxProtoVersion); + + // Now that the protocol version is known, the mission load is safe + // as it will use the right MAVLink version to enable all features + // the vehicle supports + _startPlanRequest(); } } @@ -859,7 +864,6 @@ void Vehicle::_handleCommandAck(mavlink_message_t& message) // We aren't going to get a response back for capabilities, so stop waiting for it before we ask for mission items qCDebug(VehicleLog) << "Vehicle failed to responded to MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES with error. Starting mission request."; _setCapabilities(0); - _startPlanRequest(); } if (ack.command == MAV_CMD_REQUEST_PROTOCOL_VERSION && ack.result != MAV_RESULT_ACCEPTED) { -- 2.22.0