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

config outputs now uses dropdown boxes for the update freq.

This commit is contained in:
zedamota 2011-11-29 17:01:02 +00:00
parent bea6b18246
commit fcbb00f757
2 changed files with 265 additions and 123 deletions

View File

@ -81,10 +81,10 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
// Connect the help button
connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addWidget(m_config->outputRate3);
addWidget(m_config->outputRate2);
addWidget(m_config->outputRate1);
addWidget(m_config->cb_outputRate4);
addWidget(m_config->cb_outputRate3);
addWidget(m_config->cb_outputRate2);
addWidget(m_config->cb_outputRate1);
addWidget(m_config->spinningArmed);
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
@ -277,8 +277,17 @@ void ConfigOutputWidget::refreshWidgetsValues()
m_config->spinningArmed->setChecked(actuatorSettingsData.MotorsSpinWhileArmed == ActuatorSettings::MOTORSSPINWHILEARMED_TRUE);
// Get Output rates for both banks
m_config->outputRate1->setValue(actuatorSettingsData.ChannelUpdateFreq[0]);
m_config->outputRate2->setValue(actuatorSettingsData.ChannelUpdateFreq[1]);
if(m_config->cb_outputRate1->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[0]))==-1)
{
m_config->cb_outputRate1->addItem(QString::number(actuatorSettingsData.ChannelUpdateFreq[0]));
}
if(m_config->cb_outputRate2->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[1]))==-1)
{
m_config->cb_outputRate2->addItem(QString::number(actuatorSettingsData.ChannelUpdateFreq[1]));
}
m_config->cb_outputRate1->setCurrentIndex(m_config->cb_outputRate1->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[0])));
m_config->cb_outputRate2->setCurrentIndex(m_config->cb_outputRate2->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[1])));
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
if (utilMngr) {
int board = utilMngr->getBoardModel();
@ -288,24 +297,34 @@ void ConfigOutputWidget::refreshWidgetsValues()
m_config->chBank2->setText("4");
m_config->chBank3->setText("5,7-8");
m_config->chBank4->setText("6,9-10");
m_config->outputRate1->setEnabled(true);
m_config->outputRate2->setEnabled(true);
m_config->outputRate3->setEnabled(true);
m_config->outputRate4->setEnabled(true);
m_config->outputRate3->setValue(actuatorSettingsData.ChannelUpdateFreq[2]);
m_config->outputRate4->setValue(actuatorSettingsData.ChannelUpdateFreq[3]);
m_config->cb_outputRate1->setEnabled(true);
m_config->cb_outputRate2->setEnabled(true);
m_config->cb_outputRate3->setEnabled(true);
m_config->cb_outputRate4->setEnabled(true);
if(m_config->cb_outputRate3->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[2]))==-1)
{
m_config->cb_outputRate3->addItem(QString::number(actuatorSettingsData.ChannelUpdateFreq[2]));
}
if(m_config->cb_outputRate4->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[3]))==-1)
{
m_config->cb_outputRate4->addItem(QString::number(actuatorSettingsData.ChannelUpdateFreq[3]));
}
m_config->cb_outputRate3->setCurrentIndex(m_config->cb_outputRate3->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[2])));
m_config->cb_outputRate4->setCurrentIndex(m_config->cb_outputRate4->findText(QString::number(actuatorSettingsData.ChannelUpdateFreq[3])));
} else if ((board & 0xff00) == 256 ) {
// Mainboard family
m_config->outputRate1->setEnabled(true);
m_config->outputRate2->setEnabled(true);
m_config->outputRate3->setEnabled(false);
m_config->outputRate4->setEnabled(false);
m_config->cb_outputRate1->setEnabled(true);
m_config->cb_outputRate2->setEnabled(true);
m_config->cb_outputRate3->setEnabled(false);
m_config->cb_outputRate4->setEnabled(false);
m_config->chBank1->setText("1-4");
m_config->chBank2->setText("5-8");
m_config->chBank3->setText("-");
m_config->chBank4->setText("-");
m_config->outputRate3->setValue(0);
m_config->outputRate4->setValue(0);
m_config->cb_outputRate3->addItem("0");
m_config->cb_outputRate3->setCurrentIndex(m_config->cb_outputRate3->findText("0"));
m_config->cb_outputRate4->addItem("0");
m_config->cb_outputRate4->setCurrentIndex(m_config->cb_outputRate4->findText("0"));
}
}
@ -342,11 +361,10 @@ void ConfigOutputWidget::updateObjectsFromWidgets()
}
// Set update rates
actuatorSettingsData.ChannelUpdateFreq[0] = m_config->outputRate1->value();
actuatorSettingsData.ChannelUpdateFreq[1] = m_config->outputRate2->value();
actuatorSettingsData.ChannelUpdateFreq[2] = m_config->outputRate3->value();
actuatorSettingsData.ChannelUpdateFreq[3] = m_config->outputRate4->value();
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);
}

View File

@ -38,102 +38,6 @@
<property name="spacing">
<number>2</number>
</property>
<item row="1" column="4">
<widget class="QSpinBox" name="outputRate4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</property>
<property name="maximum">
<number>400</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="chBank3">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="chBank2">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="chBank1">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="outputRate3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</property>
<property name="maximum">
<number>400</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="outputRate2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</property>
<property name="maximum">
<number>400</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="outputRate1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</property>
<property name="maximum">
<number>400</number>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="chBank4">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
@ -206,6 +110,230 @@ Leave at 50Hz for fixed wing.</string>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cb_outputRate1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</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>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="cb_outputRate2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</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>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="cb_outputRate3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</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>
</widget>
</item>
<item row="1" column="4">
<widget class="QComboBox" name="cb_outputRate4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Setup &quot;TurboPWM&quot; here: usual value is 400 Hz for multirotor airframes.
Leave at 50Hz for fixed wing.</string>
</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>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="chBank1">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="chBank2">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="chBank3">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="chBank4">
<property name="text">
<string>-</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -351,10 +479,6 @@ Applies and Saves all settings to SD</string>
</layout>
</widget>
<tabstops>
<tabstop>outputRate1</tabstop>
<tabstop>outputRate2</tabstop>
<tabstop>outputRate3</tabstop>
<tabstop>outputRate4</tabstop>
<tabstop>channelOutTest</tabstop>
<tabstop>saveRCOutputToRAM</tabstop>
<tabstop>saveRCOutputToSD</tabstop>