From ea03f8f220a1efd62fd6ab9141acb73b34c1e6ed Mon Sep 17 00:00:00 2001 From: James Cotton Date: Mon, 28 May 2012 10:40:35 -0500 Subject: [PATCH] Remove the specific function for the setSpinningArmed flag. This is now done differently with the configTaskWidget style. --- .../src/plugins/config/configoutputwidget.cpp | 62 ++++++++----------- .../src/plugins/config/configoutputwidget.h | 1 - 2 files changed, 26 insertions(+), 37 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index ff0927709..1ff7df6e1 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -77,8 +77,6 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren firstUpdate = true; - connect(m_config->spinningArmed, SIGNAL(toggled(bool)), this, SLOT(setSpinningArmed(bool))); - // Connect the help button connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); addWidget(m_config->cb_outputRate4); @@ -196,24 +194,6 @@ void ConfigOutputWidget::assignOutputChannel(UAVDataObject *obj, QString str) outputChannelForm->setAssignment(str); } -/** - * Set the "Spin motors at neutral when armed" flag in ActuatorSettings - */ -void ConfigOutputWidget::setSpinningArmed(bool val) -{ - ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager()); - Q_ASSERT(actuatorSettings); - ActuatorSettings::DataFields actuatorSettingsData = actuatorSettings->getData(); - - if(val) - actuatorSettingsData.MotorsSpinWhileArmed = ActuatorSettings::MOTORSSPINWHILEARMED_TRUE; - else - actuatorSettingsData.MotorsSpinWhileArmed = ActuatorSettings::MOTORSSPINWHILEARMED_FALSE; - - // Apply settings - actuatorSettings->setData(actuatorSettingsData); -} - /** Sends the channel value to the UAV to move the servo. Returns immediately if we are not in testing mode @@ -347,26 +327,36 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *) */ void ConfigOutputWidget::updateObjectsFromWidgets() { + emit updateObjectsFromWidgetsRequested(); + ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager()); Q_ASSERT(actuatorSettings); - ActuatorSettings::DataFields actuatorSettingsData = actuatorSettings->getData(); + if(actuatorSettings) { + ActuatorSettings::DataFields actuatorSettingsData = actuatorSettings->getData(); - // Set channel ranges - QList outputChannelForms = findChildren(); - foreach(OutputChannelForm *outputChannelForm, outputChannelForms) - { - actuatorSettingsData.ChannelMax[outputChannelForm->index()] = outputChannelForm->max(); - actuatorSettingsData.ChannelMin[outputChannelForm->index()] = outputChannelForm->min(); - actuatorSettingsData.ChannelNeutral[outputChannelForm->index()] = outputChannelForm->neutral(); + // Set channel ranges + QList outputChannelForms = findChildren(); + foreach(OutputChannelForm *outputChannelForm, outputChannelForms) + { + actuatorSettingsData.ChannelMax[outputChannelForm->index()] = outputChannelForm->max(); + actuatorSettingsData.ChannelMin[outputChannelForm->index()] = outputChannelForm->min(); + actuatorSettingsData.ChannelNeutral[outputChannelForm->index()] = outputChannelForm->neutral(); + } + + // Set update rates + actuatorSettingsData.ChannelUpdateFreq[0] = m_config->cb_outputRate1->currentText().toUInt(); + actuatorSettingsData.ChannelUpdateFreq[1] = m_config->cb_outputRate2->currentText().toUInt(); + actuatorSettingsData.ChannelUpdateFreq[2] = m_config->cb_outputRate3->currentText().toUInt(); + actuatorSettingsData.ChannelUpdateFreq[3] = m_config->cb_outputRate4->currentText().toUInt(); + + if(m_config->spinningArmed->isChecked() == true) + actuatorSettingsData.MotorsSpinWhileArmed = ActuatorSettings::MOTORSSPINWHILEARMED_TRUE; + else + actuatorSettingsData.MotorsSpinWhileArmed = ActuatorSettings::MOTORSSPINWHILEARMED_FALSE; + + // Apply settings + actuatorSettings->setData(actuatorSettingsData); } - - // Set update rates - actuatorSettingsData.ChannelUpdateFreq[0] = m_config->cb_outputRate1->currentText().toUInt(); - actuatorSettingsData.ChannelUpdateFreq[1] = m_config->cb_outputRate2->currentText().toUInt(); - actuatorSettingsData.ChannelUpdateFreq[2] = m_config->cb_outputRate3->currentText().toUInt(); - actuatorSettingsData.ChannelUpdateFreq[3] = m_config->cb_outputRate4->currentText().toUInt(); - // Apply settings - actuatorSettings->setData(actuatorSettingsData); } void ConfigOutputWidget::openHelp() diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h index 4602487ba..e558dd6f1 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h @@ -73,7 +73,6 @@ private slots: void updateObjectsFromWidgets(); void runChannelTests(bool state); void sendChannelTest(int index, int value); - void setSpinningArmed(bool val); void openHelp(); protected: void enableControls(bool enable);