From 19875fb70b7e15e2cd5a8d9ae26dc9b8e749b029 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Sun, 30 Sep 2012 13:35:35 +0200 Subject: [PATCH] OP-39 Fixed controller identification bug. Now using telemetry manager to receive notifications about connect/disconnect. Changed text on last page in wizard. --- .../plugins/setupwizard/pages/controllerpage.cpp | 16 +++++++++++----- .../plugins/setupwizard/pages/controllerpage.h | 2 ++ .../src/plugins/setupwizard/pages/endpage.ui | 2 -- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.cpp index b17c26ab6..deed9d6eb 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.cpp @@ -42,8 +42,12 @@ ControllerPage::ControllerPage(SetupWizard *wizard, QWidget *parent) : Q_ASSERT(m_connectionManager); connect(m_connectionManager, SIGNAL(availableDevicesChanged(QLinkedList)), this, SLOT(devicesChanged(QLinkedList))); - connect(m_connectionManager, SIGNAL(deviceConnected(QIODevice*)), this, SLOT(connectionStatusChanged())); - connect(m_connectionManager, SIGNAL(deviceDisconnected()), this, SLOT(connectionStatusChanged())); + ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); + Q_ASSERT(pluginManager); + m_telemtryManager = pluginManager->getObject(); + Q_ASSERT(m_telemtryManager); + connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged())); + connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged())); connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectDisconnect())); @@ -70,7 +74,7 @@ void ControllerPage::initializePage() bool ControllerPage::isComplete() const { - return m_connectionManager->isConnected() && ui->boardTypeCombo->currentIndex() > 0 && + return m_telemtryManager->isConnected() && ui->boardTypeCombo->currentIndex() > 0 && m_connectionManager->getCurrentDevice().getConName().startsWith("USB:", Qt::CaseInsensitive); } @@ -82,7 +86,7 @@ bool ControllerPage::validatePage() bool ControllerPage::anyControllerConnected() { - return m_connectionManager->isConnected(); + return m_telemtryManager->isConnected(); } SetupWizard::CONTROLLER_TYPE ControllerPage::getControllerType() @@ -164,7 +168,7 @@ void ControllerPage::devicesChanged(QLinkedList devices) if(indexOfSelectedItem != -1) { ui->deviceCombo->setCurrentIndex(indexOfSelectedItem); } - connectionStatusChanged(); + //connectionStatusChanged(); } void ControllerPage::connectionStatusChanged() @@ -183,6 +187,7 @@ void ControllerPage::connectionStatusChanged() SetupWizard::CONTROLLER_TYPE type = getControllerType(); setControllerType(type); + qDebug() << "Connection status changed: Connected, controller type: " << getControllerType(); } else { ui->deviceCombo->setEnabled(true); @@ -190,6 +195,7 @@ void ControllerPage::connectionStatusChanged() ui->boardTypeCombo->setEnabled(false); ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(0), Qt::UserRole - 1); setControllerType(SetupWizard::CONTROLLER_UNKNOWN); + qDebug() << "Connection status changed: Disconnected"; } emit completeChanged(); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.h index c906fff5f..9370f4cd4 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/controllerpage.h @@ -31,6 +31,7 @@ #include #include #include "setupwizard.h" +#include "uavtalk/telemetrymanager.h" #include "abstractwizardpage.h" namespace Ui { @@ -56,6 +57,7 @@ private: void setupBoardTypes(); void setControllerType(SetupWizard::CONTROLLER_TYPE type); Core::ConnectionManager *m_connectionManager; + TelemetryManager *m_telemtryManager; private slots: void devicesChanged(QLinkedList devices); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui index c85c08176..b8d9f104c 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui @@ -39,8 +39,6 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">This part of the setup procedure is now complete and you are one step away from completing the setup of your OpenPilot controller.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">To complete the setup please click the Radio Setup Wizard button below to close this wizard and go directly to the Radio Setup Wizard.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Or, before trying to operate your vehicle, close this wizard, go to the Input tab in the Configuration plugin and run the Radio Setup Wizard to configure the input signals to be used. If you have already performed the Radio configuration, you can skip this step. </span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p></body></html>