Browse Source

PX4 config: Insist on correct throttle position before accepting RC config end

QGC4.4
Lorenz Meier 11 years ago
parent
commit
d72185eb40
  1. 41
      src/ui/QGCPX4VehicleConfig.cc

41
src/ui/QGCPX4VehicleConfig.cc

@ -422,22 +422,31 @@ void QGCPX4VehicleConfig::setTrimPositions()
rcTrim[i] = 1500; rcTrim[i] = 1500;
} }
// Set trim to min if stick is close to min bool throttleDone = false;
if (abs(rcValue[throttleMap] - rcMin[throttleMap]) < 100) {
rcTrim[throttleMap] = rcMin[throttleMap]; // throttle while (!throttleDone) {
} // Set trim to min if stick is close to min
// Set trim to max if stick is close to max if (abs(rcValue[throttleMap] - rcMin[throttleMap]) < 100) {
else if (abs(rcValue[throttleMap] - rcMax[throttleMap]) < 100) { rcTrim[throttleMap] = rcMin[throttleMap]; // throttle
rcTrim[throttleMap] = rcMax[throttleMap]; // throttle throttleDone = true;
} }
else { // Set trim to max if stick is close to max
// Reject else if (abs(rcValue[throttleMap] - rcMax[throttleMap]) < 100) {
QMessageBox warnMsgBox; rcTrim[throttleMap] = rcMax[throttleMap]; // throttle
warnMsgBox.setText(tr("Throttle Stick Trim Position Invalid")); throttleDone = true;
warnMsgBox.setInformativeText(tr("The throttle stick is not in the min position. Please set it to the minimum value")); }
warnMsgBox.setStandardButtons(QMessageBox::Ok); else
warnMsgBox.setDefaultButton(QMessageBox::Ok); {
(void)warnMsgBox.exec(); // Reject
QMessageBox warnMsgBox;
warnMsgBox.setText(tr("Throttle Stick Trim Position Invalid"));
warnMsgBox.setInformativeText(tr("The throttle stick is not in the min position. Please set it to the zero throttle position and then click OK."));
warnMsgBox.setStandardButtons(QMessageBox::Ok);
warnMsgBox.setDefaultButton(QMessageBox::Ok);
(void)warnMsgBox.exec();
// wait long enough to get some data
QGC::SLEEP::msleep(500);
}
} }
// Set trim for roll, pitch, yaw, throttle // Set trim for roll, pitch, yaw, throttle

Loading…
Cancel
Save