From e51aeaefda200370eb3799cb198f7f4a6061251b Mon Sep 17 00:00:00 2001 From: Pierre TILAK Date: Fri, 6 Sep 2019 10:55:03 +1200 Subject: [PATCH] Re-add remove if statement Add again test to insure log is not suspend and tempfile log is open --- src/comm/MAVLinkProtocol.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 073fe5568..5e43702c9 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -170,21 +170,23 @@ void MAVLinkProtocol::logSentBytes(LinkInterface* link, QByteArray b){ uint8_t bytes_time[sizeof(quint64)]; Q_UNUSED(link); + if (!_logSuspendError && !_logSuspendReplay && _tempLogFile.isOpen()) { - quint64 time = static_cast(QDateTime::currentMSecsSinceEpoch() * 1000); + quint64 time = static_cast(QDateTime::currentMSecsSinceEpoch() * 1000); - qToBigEndian(time,bytes_time); + qToBigEndian(time,bytes_time); - b.insert(0,QByteArray((const char*)bytes_time,sizeof(bytes_time))); + b.insert(0,QByteArray((const char*)bytes_time,sizeof(bytes_time))); - int len = b.count(); + int len = b.count(); - if(_tempLogFile.write(b) != len) - { - // If there's an error logging data, raise an alert and stop logging. - emit protocolStatusMessage(tr("MAVLink Protocol"), tr("MAVLink Logging failed. Could not write to file %1, logging disabled.").arg(_tempLogFile.fileName())); - _stopLogging(); - _logSuspendError = true; + if(_tempLogFile.write(b) != len) + { + // If there's an error logging data, raise an alert and stop logging. + emit protocolStatusMessage(tr("MAVLink Protocol"), tr("MAVLink Logging failed. Could not write to file %1, logging disabled.").arg(_tempLogFile.fileName())); + _stopLogging(); + _logSuspendError = true; + } } } -- 2.22.0