1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Stopped slider going to maximum if the maximum value is manually changed .. way too dangerous if motor outputs enabled

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2483 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-01-19 18:15:03 +00:00 committed by pip
parent 5f87966727
commit 4f5bfead3b

View File

@ -454,25 +454,32 @@ void ConfigServoWidget::saveRCOutputObject()
void ConfigServoWidget::setChOutRange()
{
QSpinBox *spinbox = (QSpinBox*)QObject::sender();
int index = outMin.indexOf(spinbox); // This is the channel number
if (index < 0)
index = outMax.indexOf(spinbox); // We can't know if the signal came from min or max
QSlider *slider = outSliders[index];
int oldMini = slider->minimum();
int oldMaxi = slider->maximum();
if (outMin[index]->value()<outMax[index]->value()) {
slider->setRange(outMin[index]->value(),
outMax[index]->value());
if (outMin[index]->value()<outMax[index]->value())
{
slider->setRange(outMin[index]->value(), outMax[index]->value());
reversals[index]->setChecked(false);
} else {
slider->setRange(outMax[index]->value(),
outMin[index]->value());
}
else
{
slider->setRange(outMax[index]->value(), outMin[index]->value());
reversals[index]->setChecked(true);
}
if (slider->value()==oldMini)
if (slider->value() == oldMini)
slider->setValue(slider->minimum());
if (slider->value()==oldMaxi)
slider->setValue(slider->maximum());
// if (slider->value() == oldMaxi)
// slider->setValue(slider->maximum()); // this can be dangerous if it happens to be controlling a motor at the time!
}
/**