diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml index f0c1b68a38c078485da9f11b00304cc878f5fec0..a02c801b750dc89b0bbc88cdc5c6716f0b79e593 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.qml +++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml @@ -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 { diff --git a/src/AutoPilotPlugins/PX4/PowerComponentController.cc b/src/AutoPilotPlugins/PX4/PowerComponentController.cc index 4b2c076a5c62a0605dcfce5e980b2626e31ef775..ce17b810ec754660d3634474814e6e4dda759b32 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponentController.cc +++ b/src/AutoPilotPlugins/PX4/PowerComponentController.cc @@ -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; diff --git a/src/AutoPilotPlugins/PX4/PowerComponentController.h b/src/AutoPilotPlugins/PX4/PowerComponentController.h index 3c7704575d4c747c59b8e07f12570e174a8834c5..0b99874df3c3cda11b1a49bf0ba2eadb3d1496c9 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponentController.h +++ b/src/AutoPilotPlugins/PX4/PowerComponentController.h @@ -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);