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

OP-39 Removed the motor max rate calibration steps from the wizard. Hardcoded max rate to 1900 ms for now.

Fixed a bug with button enable/disable in the output calibration page.
This commit is contained in:
Fredrik Arvidsson 2012-09-13 23:49:08 +02:00
parent 4a09886e91
commit 463c14bf84
4 changed files with 29 additions and 150 deletions

View File

@ -67,42 +67,42 @@ void OutputCalibrationPage::setupVehicle()
switch(getWizard()->getVehicleSubType())
{
case SetupWizard::MULTI_ROTOR_TRI_Y:
m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 3 << 4 << 5;
m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4;
m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1";
m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 4;
m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 3;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 4 << 4;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 3 << 3;
m_actuatorSettings[4].channelMin = 1500;
m_actuatorSettings[4].channelMax = 1500;
break;
case SetupWizard::MULTI_ROTOR_QUAD_X:
m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2;
m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4";
m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4;
m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
m_channelIndex << 0 << 0 << 1 << 2 << 3;
break;
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2;
m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4";
m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4;
m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
m_channelIndex << 0 << 0 << 1 << 2 << 3;
break;
case SetupWizard::MULTI_ROTOR_HEXA:
m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2;
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6";
m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5 << 6 << 6;
m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
break;
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2;
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5";
m_vehicleHighlightElementIndexes << 0 << 2 << 2 << 1 << 1 << 4 << 4 << 3 << 3 << 6 << 6 << 5 << 5;
m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5;
m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
break;
case SetupWizard::MULTI_ROTOR_HEXA_H:
m_wizardIndexes << 0 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 2;
m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6";
m_vehicleHighlightElementIndexes << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5 << 6 << 6;
m_channelIndex << 0 << 0 << 0 << 1 << 1 << 2 << 2 << 3 << 3 << 4 << 4 << 5 << 5;
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
break;
default:
break;
@ -184,16 +184,13 @@ void OutputCalibrationPage::setWizardPage()
if(currentPageIndex == 1) {
ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);
}
else if (currentPageIndex == 2) {
ui->motorMaxSlider->setValue(m_actuatorSettings[currentChannel].channelMax);
}
else if(currentPageIndex == 3) {
else if(currentPageIndex == 2) {
ui->servoCenterSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);
}
else if(currentPageIndex == 4) {
else if(currentPageIndex == 3) {
ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin);
}
else if(currentPageIndex == 5) {
else if(currentPageIndex == 4) {
ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax);
}
}
@ -246,8 +243,8 @@ quint16 OutputCalibrationPage::getCurrentChannel()
void OutputCalibrationPage::enableButtons(bool enable)
{
ui->nextPageButton->setEnabled(enable);
ui->backPageButton->setEnabled(enable);
ui->nextPageButton->setEnabled(enable && (m_currentWizardIndex < m_wizardIndexes.size() - 1));
ui->backPageButton->setEnabled(enable && (m_currentWizardIndex > 0));
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
@ -313,22 +310,6 @@ void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value)
}
}
void OutputCalibrationPage::on_motorMaxButton_toggled(bool checked)
{
ui->motorMaxButton->setText(checked ? tr("Stop") : tr("Start"));
quint16 channel = getCurrentChannel();
onStartButtonToggle(ui->motorMaxButton, channel, m_actuatorSettings[channel].channelMax, 1000, ui->motorMaxSlider);
}
void OutputCalibrationPage::on_motorMaxSlider_valueChanged(int position)
{
if(ui->motorMaxButton->isChecked()) {
quint16 value = ui->motorMaxSlider->value();
m_calibrationUtil->setChannelOutputValue(value);
m_actuatorSettings[getCurrentChannel()].channelMax = value;
}
}
void OutputCalibrationPage::on_servoCenterButton_toggled(bool checked)
{
ui->servoCenterButton->setText(checked ? tr("Stop") : tr("Start"));

View File

@ -58,9 +58,6 @@ private slots:
void on_motorNeutralButton_toggled(bool checked);
void on_motorNeutralSlider_valueChanged(int value);
void on_motorMaxButton_toggled(bool checked);
void on_motorMaxSlider_valueChanged(int position);
void on_servoCenterButton_toggled(bool checked);
void on_servoCenterSlider_valueChanged(int position);

View File

@ -36,7 +36,7 @@
</rect>
</property>
<property name="currentIndex">
<number>5</number>
<number>2</number>
</property>
<widget class="QWidget" name="intro">
<widget class="QLabel" name="label_3">
@ -136,89 +136,6 @@
</property>
</widget>
</widget>
<widget class="QWidget" name="motorMax">
<widget class="QPushButton" name="motorMaxButton">
<property name="geometry">
<rect>
<x>90</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Start</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>261</width>
<height>171</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Now it is time to find out the maximum rate for the motor highlighted in the illustration to the right. &lt;/p&gt;&lt;p&gt;To find the maximum rate for this engine, press the Start button below and slide the slider to the left until the engine just starts to slow down.&lt;/p&gt;&lt;p&gt;Running a brushless motor for a long time without proper cooling can in theory damage it. Therefore do not leave the motor running at full rate longer than neccesary.&lt;br/&gt;&lt;br/&gt;When done press button again to stop.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QSlider" name="motorMaxSlider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>200</y>
<width>241</width>
<height>19</height>
</rect>
</property>
<property name="minimum">
<number>1400</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="pageStep">
<number>20</number>
</property>
<property name="value">
<number>2000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>20</number>
</property>
</widget>
</widget>
<widget class="QWidget" name="servoNeutral">
<widget class="QLabel" name="label_6">
<property name="geometry">
@ -550,25 +467,9 @@
</hints>
</connection>
<connection>
<sender>motorMaxButton</sender>
<sender>servoMinAngleButton</sender>
<signal>toggled(bool)</signal>
<receiver>motorMaxSlider</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>147</x>
<y>291</y>
</hint>
<hint type="destinationlabel">
<x>150</x>
<y>249</y>
</hint>
</hints>
</connection>
<connection>
<sender>servoCenterButton</sender>
<signal>toggled(bool)</signal>
<receiver>servoCenterSlider</receiver>
<receiver>servoMinAngleSlider</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
@ -598,9 +499,9 @@
</hints>
</connection>
<connection>
<sender>servoMinAngleButton</sender>
<sender>servoCenterButton</sender>
<signal>toggled(bool)</signal>
<receiver>servoMinAngleSlider</receiver>
<receiver>servoCenterSlider</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">

View File

@ -47,7 +47,7 @@ struct actuatorChannelSettings {
quint16 channelMax;
//Default values
actuatorChannelSettings(): channelMin(1000), channelNeutral(1080), channelMax(1800) {}
actuatorChannelSettings(): channelMin(1000), channelNeutral(1080), channelMax(1900) {}
};