diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp index 23384e26a..21d5e01cd 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp @@ -71,11 +71,14 @@ public: ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) : ConfigTaskWidget(parent), collectingData(false), - position(-1), - m_ui(new Ui_RevoSensorsWidget()) + position(-1) { + m_ui = new Ui_RevoSensorsWidget(); m_ui->setupUi(this); + addUAVObject("RevoCalibration"); + autoLoadWidgets(); + // Initialization of the Paper plane widget m_ui->sixPointsHelp->setScene(new QGraphicsScene(this)); @@ -209,10 +212,6 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) : // Connect the signals connect(m_ui->accelBiasStart, SIGNAL(clicked()), this, SLOT(launchAccelBiasCalibration())); - RevoCalibration * revoCalibration = RevoCalibration::GetInstance(getObjectManager()); - Q_ASSERT(revoCalibration); - connect(revoCalibration, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues())); - connect(m_ui->revoCalSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(SettingsToRAM())); connect(m_ui->revoCalSettingsSaveSD, SIGNAL(clicked()), this, SLOT(SettingsToFlash())); connect(m_ui->sixPointsStart, SIGNAL(clicked()), this, SLOT(sixPointCalibrationMode())); @@ -221,16 +220,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) : // Leave this timer permanently connected. The timer itself is started and stopped. connect(&progressBarTimer, SIGNAL(timeout()), this, SLOT(incrementProgress())); - // Order is important: 1st request the settings (it will also enable the controls) - // then explicitely disable them. They will be re-enabled right afterwards by the - // configgadgetwidget if the autopilot is actually connected. - refreshValues(); - // when the AHRS Widget is instanciated, the autopilot is always connected // enableControls(false); - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); - connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); - // Connect the help button - connect(m_ui->Help, SIGNAL(clicked()), this, SLOT(openHelp())); } ConfigRevoWidget::~ConfigRevoWidget() @@ -257,12 +247,6 @@ void ConfigRevoWidget::resizeEvent(QResizeEvent *event) } -void ConfigRevoWidget::enableControls(bool enable) -{ - //m_ui->ahrsSettingsSaveRAM->setEnabled(enable); - m_ui->ahrsSettingsSaveSD->setEnabled(enable); -} - /** Starts an accelerometer bias calibration. */ @@ -752,9 +736,10 @@ void ConfigRevoWidget::drawVariancesGraph() } /** - Request current settings from the AHRS + * Called by the ConfigTaskWidget parent when RevoCalibration is updated + * to update the UI */ -void ConfigRevoWidget::refreshValues() +void ConfigRevoWidget::refreshWidgetsValues(UAVObject *) { drawVariancesGraph(); @@ -766,34 +751,6 @@ void ConfigRevoWidget::refreshValues() m_ui->calibInstructions->setText(QString("Press \"Start\" above to calibrate.")); } - -/** - Save current settings to RAM - */ -void ConfigRevoWidget::SettingsToRAM() -{ - RevoCalibration * revoCalibration = RevoCalibration::GetInstance(getObjectManager()); - Q_ASSERT(revoCalibration); - revoCalibration->updated(); -} - -/** -Save Revo calibration settings to flash - */ -void ConfigRevoWidget::SettingsToFlash() -{ - SettingsToRAM(); - - RevoCalibration * revoCalibration = RevoCalibration::GetInstance(getObjectManager()); - Q_ASSERT(revoCalibration); - saveObjectToSD(revoCalibration); -} - -void ConfigRevoWidget::openHelp() -{ - QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Revo+Configuration", QUrl::StrictMode) ); -} - /** @} @} diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.h b/ground/openpilotgcs/src/plugins/config/configrevowidget.h index b1abe2202..0d19f273a 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.h +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.h @@ -54,11 +54,10 @@ public: private: void drawVariancesGraph(); void displayPlane(QString elementID); - virtual void enableControls(bool enable); Ui_RevoSensorsWidget *m_ui; QGraphicsSvgItem *paperplane; - QGraphicsSvgItem *ahrsbargraph; + QGraphicsSvgItem *sensorsBargraph; QGraphicsSvgItem *accel_x; QGraphicsSvgItem *accel_y; QGraphicsSvgItem *accel_z; @@ -95,13 +94,10 @@ private: int position; private slots: - void openHelp(); void launchAccelBiasCalibration(); void incrementProgress(); - virtual void refreshValues(); - void SettingsToRAM(); - void SettingsToFlash(); + virtual void refreshWidgetsValues(UAVObject * obj=NULL); void savePositionData(); void computeScaleBias(); void sixPointCalibrationMode(); diff --git a/ground/openpilotgcs/src/plugins/config/revosensors.ui b/ground/openpilotgcs/src/plugins/config/revosensors.ui index e30106373..914655724 100644 --- a/ground/openpilotgcs/src/plugins/config/revosensors.ui +++ b/ground/openpilotgcs/src/plugins/config/revosensors.ui @@ -670,6 +670,12 @@ new home location unless it is in indoor mode. true + + + button:help + url:http://wiki.openpilot.org/display/Doc/Revo+Configuration + + @@ -683,6 +689,9 @@ specific calibration button on top of the screen. Apply + + button:apply + @@ -696,6 +705,9 @@ specific calibration button on top of the screen. false + + button:save +