Commit e97c3c36 authored by Don Gagne's avatar Don Gagne

Merge pull request #2210 from DonLakeFlyer/LogClose

Stop logging on last vehicle gone
parents 820e98a2 24e75cfb
......@@ -108,6 +108,8 @@ void MAVLinkProtocol::setToolbox(QGCToolbox *toolbox)
connect(this, &MAVLinkProtocol::protocolStatusMessage, _app, &QGCApplication::criticalMessageBoxOnMainThread);
connect(this, &MAVLinkProtocol::saveTempFlightDataLog, _app, &QGCApplication::saveTempFlightDataLogOnMainThread);
connect(_multiVehicleManager->vehicles(), &QmlObjectListModel::countChanged, this, &MAVLinkProtocol::_vehicleCountChanged);
emit versionCheckChanged(m_enable_version_check);
}
......@@ -217,13 +219,6 @@ void MAVLinkProtocol::_linkStatusChanged(LinkInterface* link, bool connected)
}
Q_UNUSED(found);
Q_ASSERT(found);
#ifndef __mobile__
if (_connectedLinks.count() == 0) {
// Last link is gone, close out logging
_stopLogging();
}
#endif
}
}
......@@ -634,6 +629,18 @@ int MAVLinkProtocol::getHeartbeatRate()
return _heartbeatRate;
}
void MAVLinkProtocol::_vehicleCountChanged(int count)
{
#ifndef __mobile__
if (count == 0) {
// Last vehicle is gone, close out logging
_stopLogging();
}
#else
Q_UNUSED(count);
#endif
}
#ifndef __mobile__
/// @brief Closes the log file if it is open
bool MAVLinkProtocol::_closeLogFile(void)
......
......@@ -283,6 +283,9 @@ signals:
/// @brief Emitted when a temporary log file is ready for saving
void saveTempFlightDataLog(QString tempLogfile);
private slots:
void _vehicleCountChanged(int count);
private:
void _linkStatusChanged(LinkInterface* link, bool connected);
......
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