mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1756 Added handling for svg item highlight when calibrating all motors.
This commit is contained in:
parent
c2c5d41311
commit
662f1fb3f3
@ -43,6 +43,8 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren
|
|||||||
qDebug() << "calling output calibration page";
|
qDebug() << "calling output calibration page";
|
||||||
m_vehicleRenderer = new QSvgRenderer();
|
m_vehicleRenderer = new QSvgRenderer();
|
||||||
|
|
||||||
|
connect(ui->calibrateAllMotors, SIGNAL(toggled(bool)), this, SLOT(calibrateAllMotorsChanged()));
|
||||||
|
|
||||||
// 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);
|
||||||
@ -308,6 +310,7 @@ void OutputCalibrationPage::setupVehicleItems()
|
|||||||
void OutputCalibrationPage::startWizard()
|
void OutputCalibrationPage::startWizard()
|
||||||
{
|
{
|
||||||
ui->calibrationStack->setCurrentIndex(m_wizardIndexes[0]);
|
ui->calibrationStack->setCurrentIndex(m_wizardIndexes[0]);
|
||||||
|
enableAllMotorsCheckBox(true);
|
||||||
setupVehicleHighlightedPart();
|
setupVehicleHighlightedPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +322,11 @@ void OutputCalibrationPage::setupVehicleHighlightedPart()
|
|||||||
|
|
||||||
for (int i = 0; i < m_vehicleItems.size(); i++) {
|
for (int i = 0; i < m_vehicleItems.size(); i++) {
|
||||||
QGraphicsSvgItem *item = m_vehicleItems[i];
|
QGraphicsSvgItem *item = m_vehicleItems[i];
|
||||||
item->setOpacity((highlightedIndex == i) ? highlightOpaque : dimOpaque);
|
if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_wizardIndexes[m_currentWizardIndex] == 1)) {
|
||||||
|
item->setOpacity(highlightOpaque);
|
||||||
|
} else {
|
||||||
|
item->setOpacity(dimOpaque);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,12 +428,24 @@ quint16 OutputCalibrationPage::getCurrentChannel()
|
|||||||
return m_channelIndex[m_currentWizardIndex];
|
return m_channelIndex[m_currentWizardIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputCalibrationPage::enableAllMotorsCheckBox(bool enable)
|
||||||
|
{
|
||||||
|
if (getWizard()->getVehicleType() == SetupWizard::VEHICLE_MULTI) {
|
||||||
|
ui->calibrateAllMotors->setVisible(true);
|
||||||
|
ui->calibrateAllMotors->setEnabled(enable);
|
||||||
|
} else {
|
||||||
|
ui->calibrateAllMotors->setChecked(false);
|
||||||
|
ui->calibrateAllMotors->setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OutputCalibrationPage::enableButtons(bool enable)
|
void OutputCalibrationPage::enableButtons(bool enable)
|
||||||
{
|
{
|
||||||
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
|
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
|
||||||
getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
|
getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
|
||||||
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
|
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
|
||||||
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
|
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
|
||||||
|
enableAllMotorsCheckBox(enable);
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,6 +670,11 @@ void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputCalibrationPage::on_calibrateAllMotors_toggled(bool checked)
|
||||||
|
{
|
||||||
|
setupVehicleHighlightedPart();
|
||||||
|
}
|
||||||
|
|
||||||
void OutputCalibrationPage::resetOutputCalibrationUtil()
|
void OutputCalibrationPage::resetOutputCalibrationUtil()
|
||||||
{
|
{
|
||||||
if (m_calibrationUtil) {
|
if (m_calibrationUtil) {
|
||||||
|
@ -70,6 +70,7 @@ private slots:
|
|||||||
void on_servoMinAngleSlider_valueChanged(int position);
|
void on_servoMinAngleSlider_valueChanged(int position);
|
||||||
void on_servoMaxAngleSlider_valueChanged(int position);
|
void on_servoMaxAngleSlider_valueChanged(int position);
|
||||||
void on_reverseCheckbox_toggled(bool checked);
|
void on_reverseCheckbox_toggled(bool checked);
|
||||||
|
void on_calibrateAllMotors_toggled(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupVehicle();
|
void setupVehicle();
|
||||||
@ -83,6 +84,7 @@ private:
|
|||||||
bool checkAlarms();
|
bool checkAlarms();
|
||||||
void debugLogChannelValues();
|
void debugLogChannelValues();
|
||||||
quint16 getCurrentChannel();
|
quint16 getCurrentChannel();
|
||||||
|
void enableAllMotorsCheckBox(bool enable);
|
||||||
|
|
||||||
Ui::OutputCalibrationPage *ui;
|
Ui::OutputCalibrationPage *ui;
|
||||||
QSvgRenderer *m_vehicleRenderer;
|
QSvgRenderer *m_vehicleRenderer;
|
||||||
|
@ -124,7 +124,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cb_all_motor_outputs">
|
<widget class="QCheckBox" name="calibrateAllMotors">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Calibrate all motor outputs at the same time</string>
|
<string>Calibrate all motor outputs at the same time</string>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user