1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-1466 Add a 'Prev' button for servo adjustement

This commit is contained in:
Laurent Lalanne 2015-02-27 02:27:15 +01:00
parent edb41b698a
commit c9b80ca0a1
3 changed files with 50 additions and 4 deletions

View File

@ -1968,14 +1968,42 @@ margin:1px;
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>0</number>
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>30</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QPushButton" name="SwashLvlPrevButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>85</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>85</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Prev</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="SwashLvlStartButton">
<property name="minimumSize">
@ -3240,7 +3268,6 @@ margin:1px;</string>
<tabstop>ccpmCollectiveSlider</tabstop>
<tabstop>ccpmCollectivespinBox</tabstop>
<tabstop>SwashplateImage</tabstop>
<tabstop>SwashLvlStartButton</tabstop>
<tabstop>SwashLvlNextButton</tabstop>
<tabstop>SwashLvlStepInstruction</tabstop>
<tabstop>SwashLvlCancelButton</tabstop>

View File

@ -257,6 +257,7 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
connect(m_aircraft->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed()));
connect(m_aircraft->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed()));
connect(m_aircraft->SwashLvlPrevButton, SIGNAL(clicked()), this, SLOT(SwashLvlPrevButtonPressed()));
connect(m_aircraft->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed()));
connect(m_aircraft->SwashLvlFinishButton, SIGNAL(clicked()), this, SLOT(SwashLvlFinishButtonPressed()));
@ -1094,6 +1095,7 @@ void ConfigCcpmWidget::SwashLvlStartButtonPressed()
m_aircraft->SwashLvlStartButton->setEnabled(false);
m_aircraft->SwashLvlNextButton->setEnabled(true);
m_aircraft->SwashLvlPrevButton->setEnabled(false);
m_aircraft->SwashLvlCancelButton->setEnabled(true);
m_aircraft->SwashLvlFinishButton->setEnabled(false);
// clear status check boxes
@ -1155,6 +1157,7 @@ void ConfigCcpmWidget::SwashLvlStartButtonPressed()
m_aircraft->SwashLvlStartButton->setEnabled(true);
m_aircraft->SwashLvlNextButton->setEnabled(false);
m_aircraft->SwashLvlPrevButton->setEnabled(false);
m_aircraft->SwashLvlCancelButton->setEnabled(false);
m_aircraft->SwashLvlFinishButton->setEnabled(false);
break;
@ -1164,15 +1167,24 @@ void ConfigCcpmWidget::SwashLvlStartButtonPressed()
}
}
void ConfigCcpmWidget::SwashLvlPrevButtonPressed()
{
SwashLvlState--;
SwashLvlPrevNextButtonPressed();
}
void ConfigCcpmWidget::SwashLvlNextButtonPressed()
{
// ShowDisclaimer(2);
SwashLvlState++;
SwashLvlPrevNextButtonPressed();
}
void ConfigCcpmWidget::SwashLvlPrevNextButtonPressed()
{
switch (SwashLvlState) {
case 0:
break;
case 1: // Neutral levelling
m_aircraft->SwashLvlPrevButton->setEnabled(false);
m_aircraft->SwashLvlStepList->setCurrentRow(0);
// set spin boxes and swashplate servos to Neutral values
setSwashplateLevel(50);
@ -1192,6 +1204,7 @@ void ConfigCcpmWidget::SwashLvlNextButtonPressed()
tr("<h2>Neutral levelling</h2><p>Using adjustment of:<ul><li>Servo horns,</li><li>Link lengths,</li><li>Neutral triming spinboxes to the right</li></ul><br>Ensure that the swashplate is in the center of desired travel range and is level."));
break;
case 2: // Max levelling
m_aircraft->SwashLvlPrevButton->setEnabled(true);
// check Neutral status as complete
m_aircraft->SwashLvlStepList->item(0)->setCheckState(Qt::Checked);
m_aircraft->SwashLvlStepList->setCurrentRow(1);
@ -1219,6 +1232,7 @@ void ConfigCcpmWidget::SwashLvlNextButtonPressed()
break;
case 4: // levelling verification
// check Min status as complete
m_aircraft->SwashLvlNextButton->setEnabled(true);
m_aircraft->SwashLvlStepList->item(2)->setCheckState(Qt::Checked);
m_aircraft->SwashLvlStepList->setCurrentRow(3);
// enable position slider
@ -1252,6 +1266,7 @@ void ConfigCcpmWidget::SwashLvlNextButtonPressed()
m_aircraft->SwashLvlStartButton->setEnabled(false);
m_aircraft->SwashLvlNextButton->setEnabled(false);
m_aircraft->SwashLvlPrevButton->setEnabled(true);
m_aircraft->SwashLvlCancelButton->setEnabled(true);
m_aircraft->SwashLvlFinishButton->setEnabled(true);
@ -1275,6 +1290,7 @@ void ConfigCcpmWidget::SwashLvlCancelButtonPressed()
m_aircraft->SwashLvlStartButton->setEnabled(true);
m_aircraft->SwashLvlNextButton->setEnabled(false);
m_aircraft->SwashLvlPrevButton->setEnabled(false);
m_aircraft->SwashLvlCancelButton->setEnabled(false);
m_aircraft->SwashLvlFinishButton->setEnabled(false);
@ -1318,6 +1334,7 @@ void ConfigCcpmWidget::SwashLvlFinishButtonPressed()
m_aircraft->SwashLvlStartButton->setEnabled(true);
m_aircraft->SwashLvlNextButton->setEnabled(false);
m_aircraft->SwashLvlPrevButton->setEnabled(false);
m_aircraft->SwashLvlCancelButton->setEnabled(false);
m_aircraft->SwashLvlFinishButton->setEnabled(false);

View File

@ -120,7 +120,9 @@ private slots:
void UpdateType();
void SwashLvlStartButtonPressed();
void SwashLvlPrevButtonPressed();
void SwashLvlNextButtonPressed();
void SwashLvlPrevNextButtonPressed();
void SwashLvlCancelButtonPressed();
void SwashLvlFinishButtonPressed();