Browse Source

Better handling of battery already connected warning

QGC4.4
Don Gagne 10 years ago
parent
commit
23624919ab
  1. 1
      src/AutoPilotPlugins/PX4/PowerComponent.qml
  2. 7
      src/AutoPilotPlugins/PX4/PowerComponentController.cc
  3. 1
      src/AutoPilotPlugins/PX4/PowerComponentController.h

1
src/AutoPilotPlugins/PX4/PowerComponent.qml

@ -110,6 +110,7 @@ QGCView { @@ -110,6 +110,7 @@ QGCView {
onCalibrationFailed: showMessage("ESC Calibration failed", errorMessage, StandardButton.Ok)
onCalibrationSuccess: showMessage("ESC Calibration", "Calibration complete. You can disconnect your battery now if you like.", StandardButton.Ok)
onConnectBattery: showMessage("ESC Calibration", "WARNING: Props must be removed from vehicle prior to performing ESC calibration.\n\nConnect the battery now and calibration will begin.", 0)
onDisconnectBattery: showMessage("ESC Calibration failed", "You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again.", , StandardButton.Ok)
}
Column {

7
src/AutoPilotPlugins/PX4/PowerComponentController.cc

@ -105,8 +105,15 @@ void PowerComponentController::_handleUASTextMessage(int uasId, int compId, int @@ -105,8 +105,15 @@ void PowerComponentController::_handleUASTextMessage(int uasId, int compId, int
return;
}
QString failedPrefix("calibration failed: ");
if (text.startsWith(failedPrefix)) {
QString failureText = text.right(text.length() - failedPrefix.length());
if (failureText.startsWith("Disconnect battery")) {
emit disconnectBattery();
return;
}
_stopCalibration();
emit calibrationFailed(text.right(text.length() - failedPrefix.length()));
return;

1
src/AutoPilotPlugins/PX4/PowerComponentController.h

@ -49,6 +49,7 @@ signals: @@ -49,6 +49,7 @@ signals:
void newerFirmware(void);
void incorrectFirmwareRevReporting(void);
void connectBattery(void);
void disconnectBattery(void);
void batteryConnected(void);
void calibrationFailed(const QString& errorMessage);
void calibrationSuccess(const QStringList& warningMessages);

Loading…
Cancel
Save