diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp index ad1ba9dc4..8a33727de 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp @@ -246,6 +246,7 @@ void ConnectionManager::suspendPolling() m_connectBtn->setEnabled(false); m_availableDevList->setEnabled(false); + polling = false; } /** @@ -261,6 +262,7 @@ void ConnectionManager::resumePolling() m_connectBtn->setEnabled(true); m_availableDevList->setEnabled(true); + polling = true; } /** @@ -357,8 +359,9 @@ void ConnectionManager::updateConnectionDropdown() { if(m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect()) m_availableDevList->setCurrentIndex(m_availableDevList->count()-1); - if(m_mainWindow->generalSettings()->autoConnect()) + if(m_mainWindow->generalSettings()->autoConnect() && polling) { + qDebug() << "Automatically opening device"; connectDevice(); qDebug()<<"ConnectionManager::devChanged autoconnected USB device"; } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h index 5bda7a324..53c2b4f23 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h @@ -113,7 +113,7 @@ private slots: void devChanged(IConnection *connection); void onConnectionDestroyed(QObject *obj); - void connectionsCallBack(); //used to call devChange after all the plugins are loaded + void connectionsCallBack(); //used to call devChange after all the plugins are loaded protected: QComboBox *m_availableDevList; QPushButton *m_connectBtn; @@ -128,8 +128,9 @@ protected: private: bool connectDevice(); - Internal::MainWindow *m_mainWindow; - QList connectionBackup; + bool polling; + Internal::MainWindow *m_mainWindow; + QList connectionBackup; };