From 89061ac606810ccd8bfb5f2ec941b2b67d18b51d Mon Sep 17 00:00:00 2001 From: edouard Date: Thu, 31 Mar 2011 20:48:43 +0000 Subject: [PATCH] OP-357 Config gadget now checks whether the autopilot is connected already when it is instanciated. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3114 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../src/plugins/config/configgadgetwidget.cpp | 5 ++++- .../src/plugins/uavtalk/telemetrymanager.cpp | 10 +++++++++- .../src/plugins/uavtalk/telemetrymanager.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp index 9fb4432cc..415b68192 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp @@ -91,7 +91,10 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent) TelemetryManager* telMngr = pm->getObject(); connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect())); - // ********************* + // And check whether by any chance we are not already connected + if (telMngr->isConnected()) + onAutopilotConnect(); + } ConfigGadgetWidget::~ConfigGadgetWidget() diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp index 0dced28ca..61705fb81 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp @@ -30,7 +30,8 @@ #include #include -TelemetryManager::TelemetryManager() +TelemetryManager::TelemetryManager() : + autopilotConnected(false) { moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread()); // Get UAVObjectManager instance @@ -46,6 +47,11 @@ TelemetryManager::~TelemetryManager() { } +bool TelemetryManager::isConnected() +{ + return autopilotConnected; +} + void TelemetryManager::start(QIODevice *dev) { device=dev; @@ -78,10 +84,12 @@ void TelemetryManager::onStop() void TelemetryManager::onConnect() { + autopilotConnected = true; emit connected(); } void TelemetryManager::onDisconnect() { + autopilotConnected = false; emit disconnected(); } diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h index 399279ab8..7006f1d7e 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h @@ -46,6 +46,7 @@ public: void start(QIODevice *dev); void stop(); + bool isConnected(); signals: void connected(); @@ -65,6 +66,7 @@ private: Telemetry* telemetry; TelemetryMonitor* telemetryMon; QIODevice *device; + bool autopilotConnected; }; #endif // TELEMETRYMANAGER_H