1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP-1685 Re-factored some code.

This commit is contained in:
m_thread 2015-02-22 14:46:08 +01:00
parent d3a4977947
commit e5d8255c7a
3 changed files with 138 additions and 343 deletions

View File

@ -49,27 +49,27 @@
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent) ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent)
{ {
ui = new Ui_OutputWidget(); m_ui = new Ui_OutputWidget();
ui->setupUi(this); m_ui->setupUi(this);
ui->gvFrame->setVisible(false); m_ui->gvFrame->setVisible(false);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>(); Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) { if (!settings->useExpertMode()) {
ui->saveRCOutputToRAM->setVisible(false); m_ui->saveRCOutputToRAM->setVisible(false);
} }
UAVSettingsImportExportFactory *importexportplugin = pm->getObject<UAVSettingsImportExportFactory>(); UAVSettingsImportExportFactory *importexportplugin = pm->getObject<UAVSettingsImportExportFactory>();
connect(importexportplugin, SIGNAL(importAboutToBegin()), this, SLOT(stopTests())); connect(importexportplugin, SIGNAL(importAboutToBegin()), this, SLOT(stopTests()));
connect(ui->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); connect(m_ui->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool)));
// Configure the task widget // Configure the task widget
// Connect the help button // Connect the help button
connect(ui->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); connect(m_ui->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addApplySaveButtons(ui->saveRCOutputToRAM, ui->saveRCOutputToSD); addApplySaveButtons(m_ui->saveRCOutputToRAM, m_ui->saveRCOutputToSD);
// Track the ActuatorSettings object // Track the ActuatorSettings object
addUAVObject("ActuatorSettings"); addUAVObject("ActuatorSettings");
@ -78,9 +78,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
// Register for ActuatorSettings changes: // Register for ActuatorSettings changes:
for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) {
OutputChannelForm *form = new OutputChannelForm(i, this); OutputChannelForm *form = new OutputChannelForm(i, this);
form->moveTo(*(ui->channelLayout)); form->moveTo(*(m_ui->channelLayout));
connect(ui->channelOutTest, SIGNAL(toggled(bool)), form, SLOT(enableChannelTest(bool))); connect(m_ui->channelOutTest, SIGNAL(toggled(bool)), form, SLOT(enableChannelTest(bool)));
connect(form, SIGNAL(channelChanged(int, int)), this, SLOT(sendChannelTest(int, int))); connect(form, SIGNAL(channelChanged(int, int)), this, SLOT(sendChannelTest(int, int)));
addWidget(form->ui.actuatorMin); addWidget(form->ui.actuatorMin);
@ -90,21 +90,33 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidget(form->ui.actuatorLink); addWidget(form->ui.actuatorLink);
} }
// Associate the buttons with their UAVO fields
addWidget(ui->cb_outputRate6);
addWidget(ui->cb_outputRate5);
addWidget(ui->cb_outputRate4);
addWidget(ui->cb_outputRate3);
addWidget(ui->cb_outputRate2);
addWidget(ui->cb_outputRate1);
addWidget(ui->spinningArmed);
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode1, 0, 0, true); // Associate the buttons with their UAVO fields
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode2, 1, 0, true); addWidget(m_ui->spinningArmed);
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode3, 2, 0, true); MixerSettings* mixer = MixerSettings::GetInstance(getObjectManager());
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode4, 3, 0, true); Q_ASSERT(mixer);
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode5, 4, 0, true); m_banks << OutputBankControls(mixer, m_ui->chBank1, QColor("#C6ECAE"), m_ui->cb_outputRate1, m_ui->cb_outputMode1);
addWidgetBinding("ActuatorSettings", "BankMode", ui->cb_outputMode6, 5, 0, true); m_banks << OutputBankControls(mixer, m_ui->chBank2, QColor("#91E5D3"), m_ui->cb_outputRate2, m_ui->cb_outputMode2);
m_banks << OutputBankControls(mixer, m_ui->chBank3, QColor("#FCEC52"), m_ui->cb_outputRate3, m_ui->cb_outputMode3);
m_banks << OutputBankControls(mixer, m_ui->chBank4, QColor("#C3A8FF"), m_ui->cb_outputRate4, m_ui->cb_outputMode4);
m_banks << OutputBankControls(mixer, m_ui->chBank5, QColor("#F7F7F2"), m_ui->cb_outputRate5, m_ui->cb_outputMode5);
m_banks << OutputBankControls(mixer, m_ui->chBank6, QColor("#FF9F51"), m_ui->cb_outputRate6, m_ui->cb_outputMode6);
QList<int> rates;
rates << 50 << 60 << 125 << 165 << 270 << 330 << 400 << 490;
int i = 0;
foreach(OutputBankControls controls, m_banks) {
addWidget(controls.rateCombo());
controls.rateCombo()->addItem(tr("-"), QVariant(0));
controls.rateCombo()->model()->setData(controls.rateCombo()->model()->index(0, 0), QVariant(0), Qt::UserRole - 1);
foreach (int rate, rates) {
controls.rateCombo()->addItem(tr("%1 Hz").arg(rate), rate);
}
addWidgetBinding("ActuatorSettings", "BankMode", controls.modeCombo(), i++, 0, true);
connect(controls.modeCombo(), SIGNAL(currentIndexChanged(int)), this, SLOT(onBankTypeChange()));
}
SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager()); SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
connect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *))); connect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *)));
@ -120,9 +132,10 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
ConfigOutputWidget::~ConfigOutputWidget() ConfigOutputWidget::~ConfigOutputWidget()
{ {
SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager()); SystemAlarms *systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
disconnect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *))); disconnect(systemAlarmsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateWarnings(UAVObject *)));
// Do nothing foreach(OutputBankControls controls, m_banks) {
disconnect(controls.modeCombo(), SIGNAL(currentIndexChanged(int)), this, SLOT(onBankTypeChange(int)));
}
} }
void ConfigOutputWidget::enableControls(bool enable) void ConfigOutputWidget::enableControls(bool enable)
@ -130,9 +143,9 @@ void ConfigOutputWidget::enableControls(bool enable)
ConfigTaskWidget::enableControls(enable); ConfigTaskWidget::enableControls(enable);
if (!enable) { if (!enable) {
ui->channelOutTest->setChecked(false); m_ui->channelOutTest->setChecked(false);
} }
ui->channelOutTest->setEnabled(enable); m_ui->channelOutTest->setEnabled(enable);
} }
/** /**
@ -163,9 +176,9 @@ void ConfigOutputWidget::runChannelTests(bool state)
mbox.exec(); mbox.exec();
// Unfortunately must cache this since callback will reoccur // Unfortunately must cache this since callback will reoccur
accInitialData = ActuatorCommand::GetInstance(getObjectManager())->getMetadata(); m_accInitialData = ActuatorCommand::GetInstance(getObjectManager())->getMetadata();
ui->channelOutTest->setChecked(false); m_ui->channelOutTest->setChecked(false);
return; return;
} }
@ -179,7 +192,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
if (retval != QMessageBox::Yes) { if (retval != QMessageBox::Yes) {
state = false; state = false;
qDebug() << "Cancelled"; qDebug() << "Cancelled";
ui->channelOutTest->setChecked(false); m_ui->channelOutTest->setChecked(false);
return; return;
} }
} }
@ -187,14 +200,14 @@ void ConfigOutputWidget::runChannelTests(bool state)
ActuatorCommand *obj = ActuatorCommand::GetInstance(getObjectManager()); ActuatorCommand *obj = ActuatorCommand::GetInstance(getObjectManager());
UAVObject::Metadata mdata = obj->getMetadata(); UAVObject::Metadata mdata = obj->getMetadata();
if (state) { if (state) {
accInitialData = mdata; m_accInitialData = mdata;
UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY);
UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE);
UAVObject::SetGcsTelemetryAcked(mdata, false); UAVObject::SetGcsTelemetryAcked(mdata, false);
UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE);
mdata.gcsTelemetryUpdatePeriod = 100; mdata.gcsTelemetryUpdatePeriod = 100;
} else { } else {
mdata = accInitialData; // Restore metadata mdata = m_accInitialData; // Restore metadata
} }
obj->setMetadata(mdata); obj->setMetadata(mdata);
obj->updated(); obj->updated();
@ -241,7 +254,7 @@ void ConfigOutputWidget::assignOutputChannel(UAVDataObject *obj, QString &str)
*/ */
void ConfigOutputWidget::sendChannelTest(int index, int value) void ConfigOutputWidget::sendChannelTest(int index, int value)
{ {
if (!ui->channelOutTest->isChecked()) { if (!m_ui->channelOutTest->isChecked()) {
return; return;
} }
@ -290,16 +303,6 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
// Get channel descriptions // Get channel descriptions
QStringList channelDesc = ConfigVehicleTypeWidget::getChannelDescriptions(); QStringList channelDesc = ConfigVehicleTypeWidget::getChannelDescriptions();
QList<int> channelBanks;
QList<QColor> bankColors;
bankColors
<< QColor("#C6ECAE")
<< QColor("#91E5D3")
<< QColor("#FCEC52")
<< QColor("#C3A8FF")
<< QColor("#F7F7F2")
<< QColor("#FF9F51");
// Initialize output forms // Initialize output forms
QList<OutputChannelForm *> outputChannelForms = findChildren<OutputChannelForm *>(); QList<OutputChannelForm *> outputChannelForms = findChildren<OutputChannelForm *>();
foreach(OutputChannelForm * outputChannelForm, outputChannelForms) { foreach(OutputChannelForm * outputChannelForm, outputChannelForms) {
@ -315,37 +318,19 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
} }
// Get the SpinWhileArmed setting // Get the SpinWhileArmed setting
ui->spinningArmed->setChecked(actuatorSettingsData.MotorsSpinWhileArmed == ActuatorSettings::MOTORSSPINWHILEARMED_TRUE); m_ui->spinningArmed->setChecked(actuatorSettingsData.MotorsSpinWhileArmed == ActuatorSettings::MOTORSSPINWHILEARMED_TRUE);
QList<QLabel *> bank;
bank << ui->chBank1 << ui->chBank2 << ui->chBank3 << ui->chBank4 << ui->chBank5 << ui->chBank6;
QList<QComboBox *> outputRateCombos;
outputRateCombos << ui->cb_outputRate1 << ui->cb_outputRate2 << ui->cb_outputRate3 <<
ui->cb_outputRate4 << ui->cb_outputRate5 << ui->cb_outputRate6;
QList<QComboBox *> outputModeCombos;
outputModeCombos << ui->cb_outputMode1 << ui->cb_outputMode2 << ui->cb_outputMode3 <<
ui->cb_outputMode4 << ui->cb_outputMode5 << ui->cb_outputMode6;
Q_ASSERT(outputModeCombos.count() == outputRateCombos.count());
Q_ASSERT(outputRateCombos.count() == bank.count());
for (int i = 0; i < outputModeCombos.count(); i++) {
// Setup output rates for all banks
if (outputRateCombos.at(i)->findText(QString::number(actuatorSettingsData.BankUpdateFreq[i])) == -1) {
outputRateCombos.at(i)->addItem(QString::number(actuatorSettingsData.BankUpdateFreq[i]));
}
outputRateCombos.at(i)->setCurrentIndex(outputRateCombos.at(i)->findText(QString::number(actuatorSettingsData.BankUpdateFreq[i])));
for (int i = 0; i < m_banks.count(); i++) {
OutputBankControls controls = m_banks.at(i);
// Reset to all disabled // Reset to all disabled
bank.at(i)->setText("-"); controls.label()->setText("-");
outputRateCombos.at(i)->setEnabled(false); controls.rateCombo()->setEnabled(false);
setColor(outputRateCombos.at(i), palette().color(QPalette::Background)); setColor(controls.rateCombo(), palette().color(QPalette::Background));
controls.rateCombo()->setCurrentIndex(0);
outputModeCombos.at(i)->setEnabled(false); controls.modeCombo()->setEnabled(false);
setColor(outputModeCombos.at(i), palette().color(QPalette::Background)); setColor(controls.modeCombo(), palette().color(QPalette::Background));
} }
// Get connected board model // Get connected board model
@ -354,6 +339,7 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>(); UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
Q_ASSERT(utilMngr); Q_ASSERT(utilMngr);
QStringList bankLabels; QStringList bankLabels;
QList<int> channelBanks;
if (utilMngr) { if (utilMngr) {
int board = utilMngr->getBoardModel(); int board = utilMngr->getBoardModel();
@ -371,13 +357,20 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
int i = 0; int i = 0;
foreach(QString banklabel, bankLabels) { foreach(QString banklabel, bankLabels) {
bank[i]->setText(banklabel); OutputBankControls controls = m_banks.at(i);
outputRateCombos[i]->setEnabled(true); controls.label()->setText(banklabel);
setColor(outputRateCombos[i], bankColors[i]); int index = controls.rateCombo()->findData(actuatorSettingsData.BankUpdateFreq[i]);
outputModeCombos[i]->setEnabled(true); if (index == -1) {
setColor(outputModeCombos[i], bankColors[i]); controls.rateCombo()->addItem(tr("%1 Hz").arg(actuatorSettingsData.BankUpdateFreq[i]), actuatorSettingsData.BankUpdateFreq[i]);
}
controls.rateCombo()->setCurrentIndex(index);
controls.rateCombo()->setEnabled(controls.modeCombo()->currentIndex() == ActuatorSettings::BANKMODE_PWM);
setColor(controls.rateCombo(), controls.color());
controls.modeCombo()->setEnabled(true);
setColor(controls.modeCombo(), controls.color());
i++; i++;
} }
// Get Channel ranges: // Get Channel ranges:
i = 0; i = 0;
foreach(OutputChannelForm * outputChannelForm, outputChannelForms) { foreach(OutputChannelForm * outputChannelForm, outputChannelForms) {
@ -387,7 +380,7 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
outputChannelForm->setRange(minValue, maxValue); outputChannelForm->setRange(minValue, maxValue);
if (channelBanks.count() > i) { if (channelBanks.count() > i) {
outputChannelForm->setBank(QString("%1").arg(channelBanks.at(i))); outputChannelForm->setBank(QString("%1").arg(channelBanks.at(i)));
outputChannelForm->setColor(bankColors[channelBanks.at(i++) - 1]); outputChannelForm->setColor(m_banks.at(channelBanks.at(i++) - 1).color());
} }
int neutral = actuatorSettingsData.ChannelNeutral[outputChannelForm->index()]; int neutral = actuatorSettingsData.ChannelNeutral[outputChannelForm->index()];
outputChannelForm->setNeutral(neutral); outputChannelForm->setNeutral(neutral);
@ -418,14 +411,14 @@ void ConfigOutputWidget::updateObjectsFromWidgets()
} }
// Set update rates // Set update rates
actuatorSettingsData.BankUpdateFreq[0] = ui->cb_outputRate1->currentText().toUInt(); actuatorSettingsData.BankUpdateFreq[0] = m_ui->cb_outputRate1->currentData().toUInt();
actuatorSettingsData.BankUpdateFreq[1] = ui->cb_outputRate2->currentText().toUInt(); actuatorSettingsData.BankUpdateFreq[1] = m_ui->cb_outputRate2->currentData().toUInt();
actuatorSettingsData.BankUpdateFreq[2] = ui->cb_outputRate3->currentText().toUInt(); actuatorSettingsData.BankUpdateFreq[2] = m_ui->cb_outputRate3->currentData().toUInt();
actuatorSettingsData.BankUpdateFreq[3] = ui->cb_outputRate4->currentText().toUInt(); actuatorSettingsData.BankUpdateFreq[3] = m_ui->cb_outputRate4->currentData().toUInt();
actuatorSettingsData.BankUpdateFreq[4] = ui->cb_outputRate5->currentText().toUInt(); actuatorSettingsData.BankUpdateFreq[4] = m_ui->cb_outputRate5->currentData().toUInt();
actuatorSettingsData.BankUpdateFreq[5] = ui->cb_outputRate6->currentText().toUInt(); actuatorSettingsData.BankUpdateFreq[5] = m_ui->cb_outputRate6->currentData().toUInt();
actuatorSettingsData.MotorsSpinWhileArmed = ui->spinningArmed->isChecked() ? actuatorSettingsData.MotorsSpinWhileArmed = m_ui->spinningArmed->isChecked() ?
ActuatorSettings::MOTORSSPINWHILEARMED_TRUE : ActuatorSettings::MOTORSSPINWHILEARMED_TRUE :
ActuatorSettings::MOTORSSPINWHILEARMED_FALSE; ActuatorSettings::MOTORSSPINWHILEARMED_FALSE;
@ -439,9 +432,24 @@ void ConfigOutputWidget::openHelp()
QDesktopServices::openUrl(QUrl(tr("http://wiki.openpilot.org/x/WIGf"), QUrl::StrictMode)); QDesktopServices::openUrl(QUrl(tr("http://wiki.openpilot.org/x/WIGf"), QUrl::StrictMode));
} }
void ConfigOutputWidget::onBankTypeChange()
{
QComboBox* bankModeCombo = qobject_cast<QComboBox*>(sender());
if (bankModeCombo != NULL) {
foreach(OutputBankControls controls, m_banks) {
if (controls.modeCombo() == bankModeCombo) {
bool enabled = bankModeCombo->currentIndex() == ActuatorSettings::BANKMODE_PWM;
controls.rateCombo()->setEnabled(enabled);
controls.rateCombo()->setCurrentIndex(enabled ? 1 : 0);
break;
}
}
}
}
void ConfigOutputWidget::stopTests() void ConfigOutputWidget::stopTests()
{ {
ui->channelOutTest->setChecked(false); m_ui->channelOutTest->setChecked(false);
} }
void ConfigOutputWidget::updateWarnings(UAVObject *) void ConfigOutputWidget::updateWarnings(UAVObject *)
@ -453,8 +461,9 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) { switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) {
case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT: case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT:
setWarning(tr("OneShot only works with Receiver Port settings marked with '+OneShot'<br>" setWarning(tr("OneShot only works with Receiver Port settings marked with '+OneShot'<br>"
"When using Receiver Port setting 'PPM_PIN6+OneShot' " "When using Receiver Port setting 'PPM_PIN8+OneShot' "
"<b><font color='#C3A8FF'>Bank 4 (output 6,9-10)</font></b> must be set to PWM")); "<b><font color='%1'>Bank %2</font></b> must be set to PWM")
.arg(m_banks.at(3).color().name()).arg(m_banks.at(3).label()->text()));
return; return;
} }
} }
@ -463,7 +472,17 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
void ConfigOutputWidget::setWarning(QString message) void ConfigOutputWidget::setWarning(QString message)
{ {
ui->gvFrame->setVisible(!message.isNull()); m_ui->gvFrame->setVisible(!message.isNull());
ui->picWarning->setPixmap(message.isNull() ? QPixmap() : QPixmap(":/configgadget/images/error.svg")); m_ui->picWarning->setPixmap(message.isNull() ? QPixmap() : QPixmap(":/configgadget/images/error.svg"));
ui->txtWarning->setText(message); m_ui->txtWarning->setText(message);
}
OutputBankControls::OutputBankControls(MixerSettings* mixer, QLabel *label, QColor color, QComboBox *rateCombo, QComboBox *modeCombo) :
m_mixer(mixer), m_label(label), m_color(color), m_rateCombo(rateCombo), m_modeCombo(modeCombo)
{
}
OutputBankControls::~OutputBankControls()
{
} }

View File

@ -36,11 +36,31 @@
#include "cfg_vehicletypes/vehicleconfig.h" #include "cfg_vehicletypes/vehicleconfig.h"
#include <QWidget> #include <QWidget>
#include <QList> #include <QList>
#include <QSignalMapper>
#include "systemalarms.h" #include "systemalarms.h"
class Ui_OutputWidget; class Ui_OutputWidget;
class OutputChannelForm; class OutputChannelForm;
class MixerSettings;
class OutputBankControls {
public:
OutputBankControls(MixerSettings *mixer, QLabel* label, QColor color, QComboBox* rateCombo, QComboBox* modeCombo);
virtual ~OutputBankControls();
QLabel *label() const { return m_label; }
QColor color() const { return m_color; }
QComboBox *rateCombo() const { return m_rateCombo; }
QComboBox *modeCombo() const { return m_modeCombo; }
private:
MixerSettings* m_mixer;
QLabel* m_label;
QColor m_color;
QComboBox* m_rateCombo;
QComboBox* m_modeCombo;
};
class ConfigOutputWidget : public ConfigTaskWidget { class ConfigOutputWidget : public ConfigTaskWidget {
Q_OBJECT Q_OBJECT
@ -51,26 +71,21 @@ public:
protected: protected:
void enableControls(bool enable); void enableControls(bool enable);
void setWarning(QString message); void setWarning(QString message);
private: private:
Ui_OutputWidget *ui; Ui_OutputWidget *m_ui;
QList<QSlider> m_sliders;
QList<QSlider> sliders; int m_mccDataRate;
void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value); UAVObject::Metadata m_accInitialData;
QList<OutputBankControls> m_banks;
void assignOutputChannel(UAVDataObject *obj, QString &str);
void setColor(QWidget *widget, const QColor color);
OutputChannelForm *getOutputChannelForm(const int index) const; OutputChannelForm *getOutputChannelForm(const int index) const;
void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value);
void assignOutputChannel(UAVDataObject *obj, QString &str);
void setColor(QWidget *widget, const QColor color);
void sendAllChannelTests(); void sendAllChannelTests();
int mccDataRate;
UAVObject::Metadata accInitialData;
private slots: private slots:
void updateWarnings(UAVObject *); void updateWarnings(UAVObject *);
void stopTests(); void stopTests();
@ -79,6 +94,7 @@ private slots:
void runChannelTests(bool state); void runChannelTests(bool state);
void sendChannelTest(int index, int value); void sendChannelTest(int index, int value);
void openHelp(); void openHelp();
void onBankTypeChange();
}; };
#endif // CONFIGOUTPUTWIDGET_H #endif // CONFIGOUTPUTWIDGET_H

View File

@ -323,46 +323,6 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>60</string>
</property>
</item>
<item>
<property name="text">
<string>125</string>
</property>
</item>
<item>
<property name="text">
<string>165</string>
</property>
</item>
<item>
<property name="text">
<string>270</string>
</property>
</item>
<item>
<property name="text">
<string>330</string>
</property>
</item>
<item>
<property name="text">
<string>400</string>
</property>
</item>
<item>
<property name="text">
<string>490</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
@ -404,46 +364,6 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>60</string>
</property>
</item>
<item>
<property name="text">
<string>125</string>
</property>
</item>
<item>
<property name="text">
<string>165</string>
</property>
</item>
<item>
<property name="text">
<string>270</string>
</property>
</item>
<item>
<property name="text">
<string>330</string>
</property>
</item>
<item>
<property name="text">
<string>400</string>
</property>
</item>
<item>
<property name="text">
<string>490</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="4">
@ -475,46 +395,6 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>60</string>
</property>
</item>
<item>
<property name="text">
<string>125</string>
</property>
</item>
<item>
<property name="text">
<string>165</string>
</property>
</item>
<item>
<property name="text">
<string>270</string>
</property>
</item>
<item>
<property name="text">
<string>330</string>
</property>
</item>
<item>
<property name="text">
<string>400</string>
</property>
</item>
<item>
<property name="text">
<string>490</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="1" column="6"> <item row="1" column="6">
@ -546,46 +426,6 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>60</string>
</property>
</item>
<item>
<property name="text">
<string>125</string>
</property>
</item>
<item>
<property name="text">
<string>165</string>
</property>
</item>
<item>
<property name="text">
<string>270</string>
</property>
</item>
<item>
<property name="text">
<string>330</string>
</property>
</item>
<item>
<property name="text">
<string>400</string>
</property>
</item>
<item>
<property name="text">
<string>490</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="2" column="6"> <item row="2" column="6">
@ -696,46 +536,6 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>60</string>
</property>
</item>
<item>
<property name="text">
<string>125</string>
</property>
</item>
<item>
<property name="text">
<string>165</string>
</property>
</item>
<item>
<property name="text">
<string>270</string>
</property>
</item>
<item>
<property name="text">
<string>330</string>
</property>
</item>
<item>
<property name="text">
<string>400</string>
</property>
</item>
<item>
<property name="text">
<string>490</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
@ -851,46 +651,6 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
<item>
<property name="text">
<string>50</string>
</property>
</item>
<item>
<property name="text">
<string>60</string>
</property>
</item>
<item>
<property name="text">
<string>125</string>
</property>
</item>
<item>
<property name="text">
<string>165</string>
</property>
</item>
<item>
<property name="text">
<string>270</string>
</property>
</item>
<item>
<property name="text">
<string>330</string>
</property>
</item>
<item>
<property name="text">
<string>400</string>
</property>
</item>
<item>
<property name="text">
<string>490</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="0" column="7"> <item row="0" column="7">