Commit a5597700 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #2098 from DonLakeFlyer/MissionLoadDelay

Wait until parameter load complete for Mission Load
parents 4e0a8403 ef4ff0d2
......@@ -45,8 +45,6 @@ MissionManager::MissionManager(Vehicle* vehicle)
_ackTimeoutTimer->setInterval(_ackTimeoutMilliseconds);
connect(_ackTimeoutTimer, &QTimer::timeout, this, &MissionManager::_ackTimeout);
requestMissionItems();
}
MissionManager::~MissionManager()
......
......@@ -87,6 +87,7 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType,
, _satelliteLock(0)
, _updateCount(0)
, _missionManager(NULL)
, _missionManagerInitialRequestComplete(false)
, _armed(false)
, _base_mode(0)
, _custom_mode(0)
......@@ -110,7 +111,8 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType,
_firmwarePlugin = FirmwarePluginManager::instance()->firmwarePluginForAutopilot(_firmwareType, _vehicleType);
_autopilotPlugin = AutoPilotPluginManager::instance()->newAutopilotPluginForVehicle(this);
connect(_autopilotPlugin, &AutoPilotPlugin::missingParametersChanged, this, &Vehicle::missingParametersChanged);
connect(_autopilotPlugin, &AutoPilotPlugin::parametersReadyChanged, this, &Vehicle::_parametersReady);
connect(_autopilotPlugin, &AutoPilotPlugin::missingParametersChanged, this, &Vehicle::missingParametersChanged);
// Refresh timer
connect(_refreshTimer, SIGNAL(timeout()), this, SLOT(_checkUpdate()));
......@@ -1101,3 +1103,11 @@ void Vehicle::_mapTrajectoryStop()
{
_mapTrajectoryTimer.stop();
}
void Vehicle::_parametersReady(bool parametersReady)
{
if (parametersReady && !_missionManagerInitialRequestComplete) {
_missionManagerInitialRequestComplete = true;
_missionManager->requestMissionItems();
}
}
......@@ -304,6 +304,7 @@ private slots:
void _sendMessage(mavlink_message_t message);
void _sendMessageMultipleNext(void);
void _addNewMapTrajectoryPoint(void);
void _parametersReady(bool parametersReady);
void _handleTextMessage (int newCount);
/** @brief Attitude from main autopilot / system state */
......@@ -409,7 +410,7 @@ private:
int _updateCount;
MissionManager* _missionManager;
QmlObjectListModel _missionItems;
bool _missionManagerInitialRequestComplete;
bool _armed; ///< true: vehicle is armed
uint8_t _base_mode; ///< base_mode from HEARTBEAT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment