From 40003034823e2f92e9a1ac56117dc9f2c0cf8ba6 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Fri, 23 Sep 2016 09:28:09 +0200 Subject: [PATCH] LP-245 config: minor logging cleanup --- .../plugins/coreplugin/connectionmanager.cpp | 18 ++++++++++-------- .../src/plugins/uavtalk/telemetrymonitor.cpp | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp index 0f8f88d9c..e068ea5bf 100644 --- a/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp @@ -72,9 +72,11 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow) : QObject::connect(m_availableDevList, SIGNAL(currentIndexChanged(int)), this, SLOT(onDeviceSelectionChanged(int))); // setup our reconnect timers + // TODO these are never started because telemetryConnected is not called anymore reconnect = new QTimer(this); - reconnectCheck = new QTimer(this); connect(reconnect, SIGNAL(timeout()), this, SLOT(reconnectSlot())); + + reconnectCheck = new QTimer(this); connect(reconnectCheck, SIGNAL(timeout()), this, SLOT(reconnectCheckSlot())); } @@ -92,7 +94,6 @@ void ConnectionManager::init() QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(aboutToRemoveObject(QObject *)), this, SLOT(aboutToRemoveObject(QObject *))); } - // TODO needs documentation? void ConnectionManager::addWidget(QWidget *widget) { @@ -272,7 +273,7 @@ void ConnectionManager::onConnectClicked() */ void ConnectionManager::telemetryConnected() { - qDebug() << "TelemetryMonitor: connected"; + qDebug() << "ConnectionManager::telemetryConnected"; if (reconnectCheck->isActive()) { reconnectCheck->stop(); @@ -284,7 +285,7 @@ void ConnectionManager::telemetryConnected() */ void ConnectionManager::telemetryDisconnected() { - qDebug() << "TelemetryMonitor: disconnected"; + qDebug() << "ConnectionManager::telemetryDisconnected"; if (m_ioDev) { if (m_connectionDevice.connection->shortName() == "Serial") { @@ -297,17 +298,18 @@ void ConnectionManager::telemetryDisconnected() void ConnectionManager::reconnectSlot() { - qDebug() << "reconnect"; + qDebug() << "ConnectionManager::reconnectSlot"; + if (m_ioDev->isOpen()) { m_ioDev->close(); } if (m_ioDev->open(QIODevice::ReadWrite)) { - qDebug() << "reconnect successfull"; + qDebug() << "ConnectionManager::reconnectSlot - reconnect successful"; reconnect->stop(); reconnectCheck->start(20000); } else { - qDebug() << "reconnect NOT successfull"; + qDebug() << "ConnectionManager::reconnectSlot - reconnect NOT successful"; } } @@ -328,7 +330,7 @@ DevListItem ConnectionManager::findDevice(const QString &devName) } } - qDebug() << "findDevice: cannot find " << devName << " in device list"; + qWarning() << "ConnectionManager::findDevice - cannot find " << devName << " in device list"; DevListItem d; d.connection = NULL; diff --git a/ground/gcs/src/plugins/uavtalk/telemetrymonitor.cpp b/ground/gcs/src/plugins/uavtalk/telemetrymonitor.cpp index 60b502edf..311398db6 100644 --- a/ground/gcs/src/plugins/uavtalk/telemetrymonitor.cpp +++ b/ground/gcs/src/plugins/uavtalk/telemetrymonitor.cpp @@ -89,7 +89,7 @@ void TelemetryMonitor::startRetrievingObjects() } } // Start retrieving - qDebug() << "TelemetryMonitor::startRetrievingObjects() - retrieving" << queue.length() << "objects"; + qDebug() << "TelemetryMonitor::startRetrievingObjects - retrieving" << queue.length() << "objects"; retrieveNextObject(); } @@ -98,7 +98,7 @@ void TelemetryMonitor::startRetrievingObjects() */ void TelemetryMonitor::stopRetrievingObjects() { - qDebug("Object retrieval has been cancelled"); + qDebug() << "TelemetryMonitor::stopRetrievingObjects - object retrieval has been cancelled"; queue.clear(); } @@ -109,7 +109,7 @@ void TelemetryMonitor::retrieveNextObject() { // If queue is empty return if (queue.isEmpty()) { - qDebug() << "TelemetryMonitor::retrieveNextObject - Object retrieval completed"; + qDebug() << "TelemetryMonitor::retrieveNextObject - object retrieval completed"; if (firmwareIAPObj->getBoardType()) { emit connected(); } else { @@ -254,12 +254,12 @@ void TelemetryMonitor::processStatsUpdates() // Act on new connections or disconnections if (gcsStats.Status == GCSTelemetryStats::STATUS_CONNECTED && gcsStats.Status != oldStatus) { statsTimer->setInterval(STATS_UPDATE_PERIOD_MS); - qDebug() << "TelemetryMonitor::processStatsUpdates() - connection with the autopilot established"; + qDebug() << "TelemetryMonitor::processStatsUpdates - connection with the autopilot established"; startRetrievingObjects(); } if (gcsStats.Status == GCSTelemetryStats::STATUS_DISCONNECTED && gcsStats.Status != oldStatus) { statsTimer->setInterval(STATS_CONNECT_PERIOD_MS); - qDebug() << "TelemetryMonitor::processStatsUpdates() - Connection with the autopilot lost"; + qDebug() << "TelemetryMonitor::processStatsUpdates - connection with the autopilot lost"; emit disconnected(); } }