From c90bf0f8e0e5f6a7ccb02bfcb3d710f6c73d74ce Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sat, 9 Aug 2014 04:26:16 +0200 Subject: [PATCH 01/12] OP-1432 Reverse_all_motors_gui_fix : Fixes all Hexacopters error when Gcs load "Reverse all motors" parameter. --- .../config/cfg_vehicletypes/configmultirotorwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 9f9a6334c..8216ca7d3 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -425,7 +425,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) // get motor 2 value for Yaw and Roll channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); - setYawMixLevel(-qRound(value / 1.27)); + setYawMixLevel(qRound(value / 1.27)); // change channels channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; @@ -454,7 +454,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) // get motor 2 value for Yaw and Roll channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); - setYawMixLevel(-qRound(value / 1.27)); + setYawMixLevel(qRound(value / 1.27)); channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); @@ -480,9 +480,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27)); // get motor 2 value for Yaw and Roll - channel += 1; + channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); - setYawMixLevel(-qRound(value / 1.27)); + setYawMixLevel(qRound(value / 1.27)); channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); From c5e0e58e6ae4c488a31fd2d1ee6840588972e88c Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Fri, 22 Aug 2014 22:38:53 +0200 Subject: [PATCH 02/12] OP-1454 - fix weak leveling bug --- flight/modules/Stabilization/outerloop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flight/modules/Stabilization/outerloop.c b/flight/modules/Stabilization/outerloop.c index b5ffb4d35..7d865b556 100644 --- a/flight/modules/Stabilization/outerloop.c +++ b/flight/modules/Stabilization/outerloop.c @@ -228,7 +228,11 @@ static void stabilizationOuterloopTask() // That would be changed to Attitude mode max angle affecting Kp // Also does not take dT into account { - float rate_input = cast_struct_to_array(stabSettings.stabBank.ManualRate, stabSettings.stabBank.ManualRate.Roll)[t] * stabilizationDesiredAxis[t] / cast_struct_to_array(stabSettings.stabBank, stabSettings.stabBank.RollMax)[t]; + float stickinput[3]; + stickinput[0] = boundf(stabilizationDesiredAxis[0] / stabSettings.stabBank.RollMax, -1.0f, 1.0f); + stickinput[1] = boundf(stabilizationDesiredAxis[1] / stabSettings.stabBank.PitchMax, -1.0f, 1.0f); + stickinput[2] = boundf(stabilizationDesiredAxis[2] / stabSettings.stabBank.YawMax, -1.0f, 1.0f); + float rate_input = stickinput[t] * cast_struct_to_array(stabSettings.stabBank.ManualRate, stabSettings.stabBank.ManualRate.Roll)[t]; float weak_leveling = local_error[t] * stabSettings.settings.WeakLevelingKp; weak_leveling = boundf(weak_leveling, -stabSettings.settings.MaxWeakLevelingRate, stabSettings.settings.MaxWeakLevelingRate); From 23ba253cbada2d72cb55e6e52b57ac9f34170cd1 Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Sat, 23 Aug 2014 09:43:30 +1000 Subject: [PATCH 03/12] Not sure if this is needed but updated the Python pri file to reflect the correct version --- ground/openpilotgcs/src/python.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/python.pri b/ground/openpilotgcs/src/python.pri index 3643adc02..a101bfb75 100644 --- a/ground/openpilotgcs/src/python.pri +++ b/ground/openpilotgcs/src/python.pri @@ -1,7 +1,7 @@ # We use python to extract git version info and generate some other files, # but it may be installed locally. The expected python version should be # kept in sync with make/tools.mk. -PYTHON_DIR = qt-5.1.0/Tools/mingw48_32/opt/bin +PYTHON_DIR = qt-5.3.1/Tools/mingw48_32/opt/bin ROOT_DIR = $$GCS_SOURCE_TREE/../.. From 3e8de2e362bbf008f7e468dc4f6f1c6f15765fea Mon Sep 17 00:00:00 2001 From: James Duley Date: Sat, 23 Aug 2014 14:53:22 +1200 Subject: [PATCH 04/12] OP-1324 removed use of env variable in python.pri --- ground/openpilotgcs/src/python.pri | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/python.pri b/ground/openpilotgcs/src/python.pri index a101bfb75..4d80b1970 100644 --- a/ground/openpilotgcs/src/python.pri +++ b/ground/openpilotgcs/src/python.pri @@ -15,7 +15,12 @@ OPENPILOT_TOOLS_DIR = $$(OPENPILOT_TOOLS_DIR) PYTHON = \"$$ROOT_DIR/tools/$$PYTHON_DIR/python\" } else { # not found, hope it's in the path... - PYTHON = \"$$(PYTHON)\" + PYTHON_VER = $$system(python --version 2>&1) + contains(PYTHON_VER, "Python 2") { + PYTHON = \"python\" + } else { + PYTHON = \"python2\" + } } } From 3dca248938bbb807cd068c6362676c1d5c494be7 Mon Sep 17 00:00:00 2001 From: James Duley Date: Sat, 23 Aug 2014 15:51:56 +1200 Subject: [PATCH 05/12] OP-1324 fixed regex --- ground/openpilotgcs/src/python.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/python.pri b/ground/openpilotgcs/src/python.pri index 4d80b1970..dda609410 100644 --- a/ground/openpilotgcs/src/python.pri +++ b/ground/openpilotgcs/src/python.pri @@ -15,8 +15,8 @@ OPENPILOT_TOOLS_DIR = $$(OPENPILOT_TOOLS_DIR) PYTHON = \"$$ROOT_DIR/tools/$$PYTHON_DIR/python\" } else { # not found, hope it's in the path... - PYTHON_VER = $$system(python --version 2>&1) - contains(PYTHON_VER, "Python 2") { + PYTHON_VER = "$$system(python --version 2>&1)" + contains(PYTHON_VER, "Python 2.*") { PYTHON = \"python\" } else { PYTHON = \"python2\" From ccb97f014cc90583e47519aab924e2eb35f101b7 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 24 Aug 2014 02:15:24 +0200 Subject: [PATCH 06/12] OP-1241 TxPID_Bank3 : Similar bug while GET data from bank --- flight/modules/TxPID/txpid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/modules/TxPID/txpid.c b/flight/modules/TxPID/txpid.c index c4b048721..5570b1948 100644 --- a/flight/modules/TxPID/txpid.c +++ b/flight/modules/TxPID/txpid.c @@ -178,7 +178,7 @@ static void updatePIDs(UAVObjEvent *ev) break; case 2: - StabilizationSettingsBank2Get((StabilizationSettingsBank2Data *)&bank); + StabilizationSettingsBank3Get((StabilizationSettingsBank3Data *)&bank); break; default: From 4874bdc1206d1911990934d97fad29faef223605 Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Mon, 25 Aug 2014 02:49:00 +1000 Subject: [PATCH 07/12] Mac path fix for Python --- ground/openpilotgcs/src/python.pri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/python.pri b/ground/openpilotgcs/src/python.pri index a101bfb75..97c66d5cc 100644 --- a/ground/openpilotgcs/src/python.pri +++ b/ground/openpilotgcs/src/python.pri @@ -15,7 +15,8 @@ OPENPILOT_TOOLS_DIR = $$(OPENPILOT_TOOLS_DIR) PYTHON = \"$$ROOT_DIR/tools/$$PYTHON_DIR/python\" } else { # not found, hope it's in the path... - PYTHON = \"$$(PYTHON)\" + !macx: { PYTHON = \"$$(PYTHON)\" } + macx: { PYTHON = \"python\"} } } From c38242f6274dfe8b5bafa895f6b0e4daa4b9913e Mon Sep 17 00:00:00 2001 From: Fredrik Larson Date: Mon, 25 Aug 2014 02:55:19 +1000 Subject: [PATCH 08/12] Missed a damn space, OCD won't let me leave it as is. --- ground/openpilotgcs/src/python.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/python.pri b/ground/openpilotgcs/src/python.pri index 97c66d5cc..15a370ae9 100644 --- a/ground/openpilotgcs/src/python.pri +++ b/ground/openpilotgcs/src/python.pri @@ -16,7 +16,7 @@ OPENPILOT_TOOLS_DIR = $$(OPENPILOT_TOOLS_DIR) } else { # not found, hope it's in the path... !macx: { PYTHON = \"$$(PYTHON)\" } - macx: { PYTHON = \"python\"} + macx: { PYTHON = \"python\" } } } From 4fa543c9256e303b26628cd18d23d8b60871a19c Mon Sep 17 00:00:00 2001 From: James Duley Date: Mon, 25 Aug 2014 09:08:42 +1200 Subject: [PATCH 09/12] OP-1324 fixed the mingw version --- ground/openpilotgcs/src/python.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/python.pri b/ground/openpilotgcs/src/python.pri index dda609410..0ce268be5 100644 --- a/ground/openpilotgcs/src/python.pri +++ b/ground/openpilotgcs/src/python.pri @@ -1,7 +1,7 @@ # We use python to extract git version info and generate some other files, # but it may be installed locally. The expected python version should be # kept in sync with make/tools.mk. -PYTHON_DIR = qt-5.3.1/Tools/mingw48_32/opt/bin +PYTHON_DIR = qt-5.3.1/Tools/mingw482_32/opt/bin ROOT_DIR = $$GCS_SOURCE_TREE/../.. From a2af596b56cac8102651b717ab77ee87dedff698 Mon Sep 17 00:00:00 2001 From: m_thread Date: Mon, 25 Aug 2014 23:45:46 +0200 Subject: [PATCH 10/12] OP-1222 Changed servo calibarion to contain min, max and center on the same page. --- .../pages/airframestabfixedwingpage.cpp | 1 - .../pages/outputcalibrationpage.cpp | 186 +++-- .../setupwizard/pages/outputcalibrationpage.h | 10 +- .../pages/outputcalibrationpage.ui | 707 +++++++++++------- 4 files changed, 571 insertions(+), 333 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/airframestabfixedwingpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/airframestabfixedwingpage.cpp index c2d5eebaf..431e84f40 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/airframestabfixedwingpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/airframestabfixedwingpage.cpp @@ -33,7 +33,6 @@ AirframeStabFixedwingPage::AirframeStabFixedwingPage(SetupWizard *wizard, QWidge ui(new Ui::AirframeStabFixedwingPage) { ui->setupUi(this); - setFinalPage(true); } AirframeStabFixedwingPage::~AirframeStabFixedwingPage() diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 969d88472..5b16e12f4 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -46,6 +46,15 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren m_vehicleScene = new QGraphicsScene(this); 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() @@ -108,17 +117,17 @@ void OutputCalibrationPage::setupVehicle() // The m_wizardIndexes array contains the index of the QStackedWidget // in the page to use for each step. - m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4; + m_wizardIndexes << 0 << 1 << 1 << 1 << 2; // All element ids to load from the svg file and manage. m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1"; // The index of the elementId to highlight ( not dim ) for each step // this is the index in the m_vehicleElementIds - 1. - m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 4 << 4; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; // The channel number to configure for each step. - m_channelIndex << 0 << 0 << 1 << 2 << 3 << 3 << 3; + m_channelIndex << 0 << 0 << 1 << 2 << 3; setupActuatorMinMaxAndNeutral(0, 2, 3); @@ -174,34 +183,34 @@ void OutputCalibrationPage::setupVehicle() // Fixed Wing case SetupWizard::FIXED_WING_DUAL_AILERON: loadSVGFile(FIXEDWING_SVG_FILE); - m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4; + m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2; m_vehicleElementIds << "aileron" << "aileron-frame" << "aileron-motor" << "aileron-ail-left" << "aileron-ail-right" << "aileron-rudder" << "aileron-elevator"; - m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4 << 5 << 5 << 5; - m_channelIndex << 0 << 2 << 0 << 0 << 0 << 1 << 1 << 1 << 3 << 3 << 3 << 4 << 4 << 4; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5; + m_channelIndex << 0 << 2 << 0 << 1 << 3 << 4; - setupActuatorMinMaxAndNeutral(3, 3, 5); + setupActuatorMinMaxAndNeutral(2, 2, 5); getWizard()->setActuatorSettings(m_actuatorSettings); break; case SetupWizard::FIXED_WING_AILERON: loadSVGFile(FIXEDWING_SVG_FILE); - m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4; + m_wizardIndexes << 0 << 1 << 2 << 2 << 2; m_vehicleElementIds << "aileron-single" << "ail2-frame" << "ail2-motor" << "ail2-aileron" << "ail2-rudder" << "ail2-elevator"; - m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4; - m_channelIndex << 0 << 2 << 0 << 0 << 0 << 4 << 4 << 4 << 1 << 1 << 1; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; + m_channelIndex << 0 << 2 << 0 << 4 << 1; - setupActuatorMinMaxAndNeutral(3, 3, 4); + setupActuatorMinMaxAndNeutral(2, 2, 4); getWizard()->setActuatorSettings(m_actuatorSettings); break; case SetupWizard::FIXED_WING_ELEVON: loadSVGFile(FIXEDWING_SVG_FILE); - m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4; + m_wizardIndexes << 0 << 1 << 2 << 2; m_vehicleElementIds << "elevon" << "elevon-frame" << "elevon-motor" << "elevon-left" << "elevon-right"; - m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3; - m_channelIndex << 0 << 2 << 0 << 0 << 0 << 1 << 1 << 1; + m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3; + m_channelIndex << 0 << 2 << 0 << 1; - setupActuatorMinMaxAndNeutral(3, 3, 3); + setupActuatorMinMaxAndNeutral(2, 2, 3); getWizard()->setActuatorSettings(m_actuatorSettings); break; @@ -283,13 +292,16 @@ void OutputCalibrationPage::setWizardPage() if (currentPageIndex == 1) { ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } else if (currentPageIndex == 2) { - ui->servoCenterSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); - } else if (currentPageIndex == 3) { - ui->servoMinAngleSlider->setMaximum(m_actuatorSettings[currentChannel].channelNeutral); - ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); - } else if (currentPageIndex == 4) { - ui->servoMaxAngleSlider->setMinimum(m_actuatorSettings[currentChannel].channelNeutral); - ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); + enableServoSliders(false); + if (ui->reverseCheckbox->isChecked()) { + ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); + ui->servoCenterAngleSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); + ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); + } else { + ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); + ui->servoCenterAngleSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); + ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); + } } } setupVehicleHighlightedPart(); @@ -360,6 +372,7 @@ void OutputCalibrationPage::enableButtons(bool enable) void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked) { ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); + ui->motorNeutralSlider->setEnabled(checked); quint16 channel = getCurrentChannel(); quint16 safeValue = m_actuatorSettings[channel].channelNeutral; onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider); @@ -370,6 +383,7 @@ void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, quint16 if (button->isChecked()) { if (checkAlarms()) { enableButtons(false); + enableServoSliders(true); m_calibrationUtil->startChannelOutput(channel, safeValue); slider->setValue(value); m_calibrationUtil->setChannelOutputValue(value); @@ -378,11 +392,20 @@ void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, quint16 } } else { m_calibrationUtil->stopChannelOutput(); + enableServoSliders(false); enableButtons(true); } debugLogChannelValues(); } +void OutputCalibrationPage::enableServoSliders(bool enabled) +{ + ui->servoCenterAngleSlider->setEnabled(enabled); + ui->servoMinAngleSlider->setEnabled(enabled); + ui->servoMaxAngleSlider->setEnabled(enabled); + ui->reverseCheckbox->setEnabled(!enabled); +} + bool OutputCalibrationPage::checkAlarms() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); @@ -434,68 +457,103 @@ void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value) } } -void OutputCalibrationPage::on_servoCenterButton_toggled(bool checked) +void OutputCalibrationPage::on_servoButton_toggled(bool checked) { - ui->servoCenterButton->setText(checked ? tr("Stop") : tr("Start")); + ui->servoButton->setText(checked ? tr("Stop") : tr("Start")); quint16 channel = getCurrentChannel(); - quint16 safeValue = m_actuatorSettings[channel].channelNeutral; - onStartButtonToggle(ui->servoCenterButton, channel, safeValue, safeValue, ui->servoCenterSlider); + quint16 safeValue = m_actuatorSettings[channel].channelNeutral; + onStartButtonToggle(ui->servoButton, channel, safeValue, safeValue, ui->servoCenterAngleSlider); } -void OutputCalibrationPage::on_servoCenterSlider_valueChanged(int position) +void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) { Q_UNUSED(position); - if (ui->servoCenterButton->isChecked()) { - quint16 value = ui->servoCenterSlider->value(); - m_calibrationUtil->setChannelOutputValue(value); - quint16 channel = getCurrentChannel(); - m_actuatorSettings[channel].channelNeutral = value; + quint16 value = ui->servoCenterAngleSlider->value(); + m_calibrationUtil->setChannelOutputValue(value); + quint16 channel = getCurrentChannel(); + m_actuatorSettings[channel].channelNeutral = value; - // Adjust min and max - if (value < m_actuatorSettings[channel].channelMin) { - m_actuatorSettings[channel].channelMin = value; + // Adjust min and max + if (ui->reverseCheckbox->isChecked()) { + if (value >= m_actuatorSettings[channel].channelMin) { + ui->servoMinAngleSlider->setValue(value); } - if (value > m_actuatorSettings[channel].channelMax) { - m_actuatorSettings[channel].channelMax = value; + if (value <= m_actuatorSettings[channel].channelMax) { + ui->servoMaxAngleSlider->setValue(value); + } + } else { + if (value <= m_actuatorSettings[channel].channelMin) { + ui->servoMinAngleSlider->setValue(value); + } + if (value >= m_actuatorSettings[channel].channelMax) { + ui->servoMaxAngleSlider->setValue(value); } - debugLogChannelValues(); } -} - -void OutputCalibrationPage::on_servoMinAngleButton_toggled(bool checked) -{ - ui->servoMinAngleButton->setText(checked ? tr("Stop") : tr("Start")); - quint16 channel = getCurrentChannel(); - quint16 safeValue = m_actuatorSettings[channel].channelNeutral; - onStartButtonToggle(ui->servoMinAngleButton, channel, m_actuatorSettings[channel].channelMin, safeValue, ui->servoMinAngleSlider); + debugLogChannelValues(); } void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position) { Q_UNUSED(position); - if (ui->servoMinAngleButton->isChecked()) { - quint16 value = ui->servoMinAngleSlider->value(); - m_calibrationUtil->setChannelOutputValue(value); - m_actuatorSettings[getCurrentChannel()].channelMin = value; - debugLogChannelValues(); - } -} + quint16 value = ui->servoMinAngleSlider->value(); + m_calibrationUtil->setChannelOutputValue(value); + m_actuatorSettings[getCurrentChannel()].channelMin = value; -void OutputCalibrationPage::on_servoMaxAngleButton_toggled(bool checked) -{ - ui->servoMaxAngleButton->setText(checked ? tr("Stop") : tr("Start")); - quint16 channel = getCurrentChannel(); - quint16 safeValue = m_actuatorSettings[channel].channelNeutral; - onStartButtonToggle(ui->servoMaxAngleButton, channel, m_actuatorSettings[channel].channelMax, safeValue, ui->servoMaxAngleSlider); + // Adjust neutral and max + if (ui->reverseCheckbox->isChecked()) { + if(value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + ui->servoCenterAngleSlider->setValue(value); + } + if(value <= m_actuatorSettings[getCurrentChannel()].channelMax) { + ui->servoMaxAngleSlider->setValue(value); + } + } else { + if(value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + ui->servoCenterAngleSlider->setValue(value); + } + if(value >= m_actuatorSettings[getCurrentChannel()].channelMax) { + ui->servoMaxAngleSlider->setValue(value); + } + } + debugLogChannelValues(); } void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) { Q_UNUSED(position); - if (ui->servoMaxAngleButton->isChecked()) { - quint16 value = ui->servoMaxAngleSlider->value(); - m_calibrationUtil->setChannelOutputValue(value); - m_actuatorSettings[getCurrentChannel()].channelMax = value; - debugLogChannelValues(); + quint16 value = ui->servoMaxAngleSlider->value(); + m_calibrationUtil->setChannelOutputValue(value); + m_actuatorSettings[getCurrentChannel()].channelMax = value; + + // Adjust neutral and min + if (ui->reverseCheckbox->isChecked()) { + if(value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + ui->servoCenterAngleSlider->setValue(value); + } + if(value >= m_actuatorSettings[getCurrentChannel()].channelMin) { + ui->servoMinAngleSlider->setValue(value); + } + } else { + if(value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + ui->servoCenterAngleSlider->setValue(value); + } + if(value <= m_actuatorSettings[getCurrentChannel()].channelMin) { + ui->servoMinAngleSlider->setValue(value); + } } + debugLogChannelValues(); +} + +void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked) +{ + if (m_actuatorSettings[getCurrentChannel()].channelMax > m_actuatorSettings[getCurrentChannel()].channelMin) { + quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax; + m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; + m_actuatorSettings[getCurrentChannel()].channelMin = oldMax; + } else if (m_actuatorSettings[getCurrentChannel()].channelMax < m_actuatorSettings[getCurrentChannel()].channelMin) { + quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax; + m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; + m_actuatorSettings[getCurrentChannel()].channelMin = oldMax; + } + setWizardPage(); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index d851fa639..998bd0cf9 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -65,14 +65,11 @@ private slots: void on_motorNeutralButton_toggled(bool checked); void on_motorNeutralSlider_valueChanged(int value); - void on_servoCenterButton_toggled(bool checked); - void on_servoCenterSlider_valueChanged(int position); - - void on_servoMinAngleButton_toggled(bool checked); + void on_servoButton_toggled(bool checked); + void on_servoCenterAngleSlider_valueChanged(int position); void on_servoMinAngleSlider_valueChanged(int position); - - void on_servoMaxAngleButton_toggled(bool checked); void on_servoMaxAngleSlider_valueChanged(int position); + void on_reverseCheckbox_toggled(bool checked); private: void setupVehicle(); @@ -81,6 +78,7 @@ private: void setupVehicleHighlightedPart(); void setWizardPage(); void enableButtons(bool enable); + void enableServoSliders(bool enabled); void onStartButtonToggle(QAbstractButton *button, quint16 channel, quint16 value, quint16 safeValue, QSlider *slider); bool checkAlarms(); void debugLogChannelValues(); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui index e69c67666..fb56f4fb1 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui @@ -31,10 +31,29 @@ + + + + + 0 + 0 + + + + + 200 + 200 + + + + QFrame::NoFrame + + + - 4 + 2 @@ -133,7 +152,7 @@ p, li { white-space: pre-wrap; } - <html><head/><body><p>This step calibrates<span style=" font-weight:600;"> the center position of the servo</span>. To set the center position for this servo, press the Start button below and slide the slider to center the servo. </p><p>When done press button again to stop.</p></body></html> + <html><head/><body><p>This step calibrates<span style=" font-weight:600;"> the minimum, center and maximum angle of the servo</span>. To set the angles for this servo, press the Start button below and slide the slider for the angle to set. The servo will follow the sliders position. <br/>When done press button again to stop.</p><p>Check Reverse to reverse servo action.</p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -144,47 +163,435 @@ p, li { white-space: pre-wrap; } - - - false - - - 600 - - - 2400 - - - 1 - - - 10 - - - 1500 - - - true - + - Qt::Horizontal + Qt::Vertical - - false - - - false - - - QSlider::TicksBelow - - - 40 + + + 20 + 40 + + + + + + + + 6 + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QSlider::groove:horizontal { + border: 1px solid rgb(196, 196, 196); + background: white; + height: 6px; + border-radius: 2px; + margin 10px 10px; +} + +QSlider::add-page:horizontal { + background: #fff; + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::add-page:horizontal:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::sub-page:horizontal { + background: rgb(78, 147, 246); + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::sub-page:horizontal:disabled { + background: #ccc; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:horizontal { + background: rgb(196, 196, 196); + width: 18px; + height: 28px; + margin: -2px 0; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::groove:vertical { + border: 1px solid rgb(196, 196, 196); + background: white; + width: 6px; + border-radius: 2px; + margin 0px -10px; + margin-top: 5px; + margin-bottom: 5px; +} + +QSlider::sub-page:vertical { + background: #fff; + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::sub-page:vertical:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical { + background: rgb(78, 147, 246); + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical:disabled { + background: #ccc; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:vertical { + background: rgb(196, 196, 196); + width: 18px; + margin: -6 -6; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::handle:vertical:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + +QSlider::handle:horizontal:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + + + 600 + + + 2400 + + + 1500 + + + Qt::Horizontal + + + + + + + QSlider::groove:horizontal { + border: 1px solid rgb(196, 196, 196); + background: white; + height: 6px; + border-radius: 2px; + margin 10px 10px; +} + +QSlider::add-page:horizontal { + background: rgb(78, 147, 246); + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::add-page:horizontal:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::sub-page:horizontal { + background: rgb(78, 147, 246); + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::sub-page:horizontal:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:horizontal { + background: rgb(196, 196, 196); + width: 18px; + height: 28px; + margin: -2px 0; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::groove:vertical { + border: 1px solid rgb(196, 196, 196); + background: white; + width: 6px; + border-radius: 2px; + margin 0px -10px; + margin-top: 5px; + margin-bottom: 5px; +} + +QSlider::sub-page:vertical { + background: #fff; + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::sub-page:vertical:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical { + background: rgb(78, 147, 246); + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical:disabled { + background: #ccc; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:vertical { + background: rgb(196, 196, 196); + width: 18px; + margin: -6 -6; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::handle:vertical:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + +QSlider::handle:horizontal:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + + + 600 + + + 2400 + + + 1500 + + + Qt::Horizontal + + + + + + + QSlider::groove:horizontal { + border: 1px solid rgb(196, 196, 196); + background: white; + height: 6px; + border-radius: 2px; + margin 10px 10px; +} + +QSlider::sub-page:horizontal { + background: #fff; + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::sub-page:horizontal:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:horizontal { + background: rgb(78, 147, 246); + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::add-page:horizontal:disabled { + background: #ccc; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:horizontal { + background: rgb(196, 196, 196); + width: 18px; + height: 28px; + margin: -2px 0; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::groove:vertical { + border: 1px solid rgb(196, 196, 196); + background: white; + width: 6px; + border-radius: 2px; + margin 0px -10px; + margin-top: 5px; + margin-bottom: 5px; +} + +QSlider::sub-page:vertical { + background: #fff; + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::sub-page:vertical:disabled { + background: #eee; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical { + background: rgb(78, 147, 246); + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical:disabled { + background: #ccc; + border: 1px solid #999; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:vertical { + background: rgb(196, 196, 196); + width: 18px; + margin: -6 -6; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::handle:vertical:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + +QSlider::handle:horizontal:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + + + 600 + + + 2400 + + + 1500 + + + Qt::Horizontal + + + false + + + + + + + Reverse + + + + + + + Min + + + + + + + Center + + + + + + + Max + + + + - + Start @@ -198,234 +605,10 @@ p, li { white-space: pre-wrap; } - - - - - - <html><head/><body><p>To save the servo and other hardware from damage we have to set the max and min angles for the servo. </p><p>To set <span style=" font-weight:600;">the minimum angle for the servo</span>, press the Start button below and select the top slider and slide it to the left until min angle is reached.</p><p>When done press button again to stop.</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - false - - - 600 - - - 2400 - - - 1 - - - 10 - - - 1500 - - - true - - - Qt::Horizontal - - - false - - - false - - - QSlider::TicksBelow - - - 40 - - - - - - - Start - - - true - - - false - - - - - - - - - - - <html><head/><body><p>To set <span style=" font-weight:600;">the maximum angle for the servo</span>, press the Start button below and select the top slider and slide it to the right until max angle is reached.</p><p>When done press button again to stop.</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - false - - - 600 - - - 2400 - - - 1 - - - 10 - - - 1500 - - - true - - - Qt::Horizontal - - - false - - - false - - - QSlider::TicksBelow - - - 40 - - - - - - - Start - - - true - - - false - - - - - - - - - - - - 0 - 0 - - - - - 200 - 200 - - - - QFrame::NoFrame - - - - motorNeutralButton - toggled(bool) - motorNeutralSlider - setEnabled(bool) - - - 147 - 291 - - - 150 - 249 - - - - - servoMinAngleButton - toggled(bool) - servoMinAngleSlider - setEnabled(bool) - - - 147 - 291 - - - 150 - 249 - - - - - servoMaxAngleButton - toggled(bool) - servoMaxAngleSlider - setEnabled(bool) - - - 147 - 291 - - - 150 - 249 - - - - - servoCenterButton - toggled(bool) - servoCenterSlider - setEnabled(bool) - - - 147 - 291 - - - 150 - 249 - - - - + From 73ca58ce0fd5cdecad8b6a8ce01fd868940bf1b4 Mon Sep 17 00:00:00 2001 From: m_thread Date: Tue, 26 Aug 2014 00:02:44 +0200 Subject: [PATCH 11/12] OP-1222 Disabled reverse. --- .../src/plugins/setupwizard/pages/outputcalibrationpage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 2c35eff2d..a7fadd1f1 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -403,7 +403,8 @@ void OutputCalibrationPage::enableServoSliders(bool enabled) ui->servoCenterAngleSlider->setEnabled(enabled); ui->servoMinAngleSlider->setEnabled(enabled); ui->servoMaxAngleSlider->setEnabled(enabled); - ui->reverseCheckbox->setEnabled(!enabled); + //ui->reverseCheckbox->setEnabled(!enabled); + ui->reverseCheckbox->setEnabled(false); } bool OutputCalibrationPage::checkAlarms() From a9dad6f4dfb798ffa278476a4a4d2a3ec9842d82 Mon Sep 17 00:00:00 2001 From: m_thread Date: Tue, 26 Aug 2014 01:22:35 +0200 Subject: [PATCH 12/12] OP-1222 Added reversed for servos. Beautification of fixed wing page. --- .../setupwizard/pages/fixedwingpage.ui | 18 ++++++--- .../pages/outputcalibrationpage.cpp | 40 ++++++++++++------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.ui index e4bba0fd7..59039632a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/fixedwingpage.ui @@ -49,11 +49,11 @@ p, li { white-space: pre-wrap; } - - - 125 - 36 - + + + 0 + 0 + @@ -69,6 +69,12 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + + 125 @@ -82,7 +88,7 @@ p, li { white-space: pre-wrap; } - + 0 0 diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index a7fadd1f1..385e4705b 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -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. m_vehicleScene = new QGraphicsScene(this); 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() @@ -292,6 +282,12 @@ void OutputCalibrationPage::setWizardPage() if (currentPageIndex == 1) { ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); } 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); if (ui->reverseCheckbox->isChecked()) { ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); @@ -403,8 +399,7 @@ void OutputCalibrationPage::enableServoSliders(bool enabled) ui->servoCenterAngleSlider->setEnabled(enabled); ui->servoMinAngleSlider->setEnabled(enabled); ui->servoMaxAngleSlider->setEnabled(enabled); - //ui->reverseCheckbox->setEnabled(!enabled); - ui->reverseCheckbox->setEnabled(false); + ui->reverseCheckbox->setEnabled(!enabled); } bool OutputCalibrationPage::checkAlarms() @@ -547,14 +542,29 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) 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; m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; 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; m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; 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); + } }