mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1222 Added reversed for servos. Beautification of fixed wing page.
This commit is contained in:
parent
73ca58ce0f
commit
a9dad6f4df
@ -49,11 +49,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
<width>125</width>
|
<horstretch>0</horstretch>
|
||||||
<height>36</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
@ -69,6 +69,12 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="typeCombo">
|
<widget class="QComboBox" name="typeCombo">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>125</width>
|
<width>125</width>
|
||||||
@ -82,7 +88,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="typeDescription">
|
<widget class="QTextEdit" name="typeDescription">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -45,16 +45,6 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren
|
|||||||
// move the code that was here to setupVehicle() so we can determine which image to use.
|
// move the code that was here to setupVehicle() so we can determine which image to use.
|
||||||
m_vehicleScene = new QGraphicsScene(this);
|
m_vehicleScene = new QGraphicsScene(this);
|
||||||
ui->vehicleView->setScene(m_vehicleScene);
|
ui->vehicleView->setScene(m_vehicleScene);
|
||||||
|
|
||||||
connect(ui->motorNeutralButton, SIGNAL(toggled(bool)), this, SLOT(on_motorNeutralButton_toggled(bool)));
|
|
||||||
connect(ui->motorNeutralSlider, SIGNAL(valueChanged(int)), this, SLOT(on_motorNeutralSlider_valueChanged(int)));
|
|
||||||
|
|
||||||
connect(ui->servoButton, SIGNAL(toggled(bool)), this, SLOT(on_servoButton_toggled(bool)));
|
|
||||||
connect(ui->servoMinAngleSlider, SIGNAL(valueChanged(int)), this, SLOT(on_servoMinAngleSlider_valueChanged(int)));
|
|
||||||
connect(ui->servoCenterAngleSlider, SIGNAL(valueChanged(int)), this, SLOT(on_servoCenterAngleSlider_valueChanged(int)));
|
|
||||||
connect(ui->servoMaxAngleSlider, SIGNAL(valueChanged(int)), this, SLOT(on_servoMaxAngleSlider_valueChanged(int)));
|
|
||||||
|
|
||||||
connect(ui->reverseCheckbox, SIGNAL(toggled(bool)), this, SLOT(on_reverseCheckbox_toggled(bool)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputCalibrationPage::~OutputCalibrationPage()
|
OutputCalibrationPage::~OutputCalibrationPage()
|
||||||
@ -292,6 +282,12 @@ void OutputCalibrationPage::setWizardPage()
|
|||||||
if (currentPageIndex == 1) {
|
if (currentPageIndex == 1) {
|
||||||
ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);
|
ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);
|
||||||
} else if (currentPageIndex == 2) {
|
} else if (currentPageIndex == 2) {
|
||||||
|
if (m_actuatorSettings[currentChannel].channelMax < m_actuatorSettings[currentChannel].channelMin &&
|
||||||
|
!ui->reverseCheckbox->isChecked()) {
|
||||||
|
ui->reverseCheckbox->setChecked(true);
|
||||||
|
} else {
|
||||||
|
ui->reverseCheckbox->setChecked(false);
|
||||||
|
}
|
||||||
enableServoSliders(false);
|
enableServoSliders(false);
|
||||||
if (ui->reverseCheckbox->isChecked()) {
|
if (ui->reverseCheckbox->isChecked()) {
|
||||||
ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax);
|
ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax);
|
||||||
@ -403,8 +399,7 @@ void OutputCalibrationPage::enableServoSliders(bool enabled)
|
|||||||
ui->servoCenterAngleSlider->setEnabled(enabled);
|
ui->servoCenterAngleSlider->setEnabled(enabled);
|
||||||
ui->servoMinAngleSlider->setEnabled(enabled);
|
ui->servoMinAngleSlider->setEnabled(enabled);
|
||||||
ui->servoMaxAngleSlider->setEnabled(enabled);
|
ui->servoMaxAngleSlider->setEnabled(enabled);
|
||||||
//ui->reverseCheckbox->setEnabled(!enabled);
|
ui->reverseCheckbox->setEnabled(!enabled);
|
||||||
ui->reverseCheckbox->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutputCalibrationPage::checkAlarms()
|
bool OutputCalibrationPage::checkAlarms()
|
||||||
@ -547,14 +542,29 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position)
|
|||||||
|
|
||||||
void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked)
|
void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (m_actuatorSettings[getCurrentChannel()].channelMax > m_actuatorSettings[getCurrentChannel()].channelMin) {
|
if (checked && m_actuatorSettings[getCurrentChannel()].channelMax > m_actuatorSettings[getCurrentChannel()].channelMin) {
|
||||||
quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax;
|
quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax;
|
||||||
m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin;
|
m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin;
|
||||||
m_actuatorSettings[getCurrentChannel()].channelMin = oldMax;
|
m_actuatorSettings[getCurrentChannel()].channelMin = oldMax;
|
||||||
} else if (m_actuatorSettings[getCurrentChannel()].channelMax < m_actuatorSettings[getCurrentChannel()].channelMin) {
|
} else if (!checked && m_actuatorSettings[getCurrentChannel()].channelMax < m_actuatorSettings[getCurrentChannel()].channelMin) {
|
||||||
quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax;
|
quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax;
|
||||||
m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin;
|
m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin;
|
||||||
m_actuatorSettings[getCurrentChannel()].channelMin = oldMax;
|
m_actuatorSettings[getCurrentChannel()].channelMin = oldMax;
|
||||||
}
|
}
|
||||||
setWizardPage();
|
ui->servoCenterAngleSlider->setInvertedAppearance(checked);
|
||||||
|
ui->servoCenterAngleSlider->setInvertedControls(checked);
|
||||||
|
ui->servoMinAngleSlider->setInvertedAppearance(checked);
|
||||||
|
ui->servoMinAngleSlider->setInvertedControls(checked);
|
||||||
|
ui->servoMaxAngleSlider->setInvertedAppearance(checked);
|
||||||
|
ui->servoMaxAngleSlider->setInvertedControls(checked);
|
||||||
|
|
||||||
|
if (ui->reverseCheckbox->isChecked()) {
|
||||||
|
ui->servoMaxAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMax);
|
||||||
|
ui->servoCenterAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelNeutral);
|
||||||
|
ui->servoMinAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMin);
|
||||||
|
} else {
|
||||||
|
ui->servoMinAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMin);
|
||||||
|
ui->servoCenterAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelNeutral);
|
||||||
|
ui->servoMaxAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMax);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user