mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
OP-1756 Added code to properly handle next and back when calibrating all motors at the same time.
This commit is contained in:
parent
8d6070d674
commit
f2c80d7d06
@ -339,7 +339,7 @@ void OutputCalibrationPage::setupVehicleHighlightedPart()
|
||||
|
||||
for (int i = 0; i < m_vehicleItems.size(); i++) {
|
||||
QGraphicsSvgItem *item = m_vehicleItems[i];
|
||||
if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_vehicleElementTypes[i] == MOTOR)) {
|
||||
if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_vehicleElementTypes[i + 1] == MOTOR)) {
|
||||
item->setOpacity(highlightOpaque);
|
||||
} else {
|
||||
item->setOpacity(dimOpaque);
|
||||
@ -402,11 +402,21 @@ void OutputCalibrationPage::initializePage()
|
||||
|
||||
bool OutputCalibrationPage::validatePage()
|
||||
{
|
||||
if (!isFinished()) {
|
||||
m_currentWizardIndex++;
|
||||
if (ui->calibrateAllMotors->isChecked() &&
|
||||
m_currentWizardIndex > 0 &&
|
||||
m_wizardIndexes[m_currentWizardIndex - 1] == 1) {
|
||||
while (!isFinished() && m_wizardIndexes[m_currentWizardIndex] == 1) {
|
||||
m_currentWizardIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isFinished()) {
|
||||
getWizard()->setActuatorSettings(m_actuatorSettings);
|
||||
return true;
|
||||
} else {
|
||||
m_currentWizardIndex++;
|
||||
setWizardPage();
|
||||
return false;
|
||||
}
|
||||
@ -432,8 +442,18 @@ void OutputCalibrationPage::resizeEvent(QResizeEvent *event)
|
||||
|
||||
void OutputCalibrationPage::customBackClicked()
|
||||
{
|
||||
if (m_currentWizardIndex > 0) {
|
||||
if (m_currentWizardIndex >= 0) {
|
||||
m_currentWizardIndex--;
|
||||
if (ui->calibrateAllMotors->isChecked()) {
|
||||
while (m_currentWizardIndex > 0 &&
|
||||
m_wizardIndexes[m_currentWizardIndex] == 1 &&
|
||||
m_wizardIndexes[m_currentWizardIndex - 1] == 1) {
|
||||
m_currentWizardIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_currentWizardIndex >= 0) {
|
||||
setWizardPage();
|
||||
} else {
|
||||
getWizard()->back();
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
bool isFinished()
|
||||
{
|
||||
return m_currentWizardIndex >= m_wizardIndexes.size() - 1;
|
||||
return m_currentWizardIndex >= m_wizardIndexes.size();
|
||||
}
|
||||
|
||||
void loadSVGFile(QString file);
|
||||
|
@ -489,6 +489,9 @@ void SetupWizard::customBackClicked()
|
||||
static_cast<OutputCalibrationPage *>(currentPage())->customBackClicked();
|
||||
} else {
|
||||
back();
|
||||
if (currentId() == PAGE_OUTPUT_CALIBRATION) {
|
||||
static_cast<OutputCalibrationPage *>(currentPage())->customBackClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user