|
|
|
@ -335,10 +335,117 @@ void APMSensorsComponentController::_handleUASTextMessage(int uasId, int compId,
@@ -335,10 +335,117 @@ void APMSensorsComponentController::_handleUASTextMessage(int uasId, int compId,
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (text.startsWith(QLatin1Literal("PreArm:")) || text.startsWith(QLatin1Literal("EKF")) |
|
|
|
|
|| text.startsWith(QLatin1Literal("Arm")) || text.startsWith(QLatin1Literal("Initialising"))) { |
|
|
|
|
QString originalMessageText = text; |
|
|
|
|
text = text.toLower(); |
|
|
|
|
|
|
|
|
|
QStringList hidePrefixList = { QStringLiteral("prearm:"), QStringLiteral("ekf"), QStringLiteral("arm"), QStringLiteral("initialising") }; |
|
|
|
|
for (const QString& hidePrefix: hidePrefixList) { |
|
|
|
|
if (text.startsWith(hidePrefix)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (_calTypeInProgress == CalTypeAccel) { |
|
|
|
|
if (text == QStringLiteral("place vehicle level and press any key.")) { |
|
|
|
|
_startVisualCalibration(); |
|
|
|
|
_cancelButton->setEnabled(false); |
|
|
|
|
|
|
|
|
|
// Reset all progress indication
|
|
|
|
|
_orientationCalDownSideDone = false; |
|
|
|
|
_orientationCalUpsideDownSideDone = false; |
|
|
|
|
_orientationCalLeftSideDone = false; |
|
|
|
|
_orientationCalRightSideDone = false; |
|
|
|
|
_orientationCalTailDownSideDone = false; |
|
|
|
|
_orientationCalNoseDownSideDone = false; |
|
|
|
|
_orientationCalDownSideInProgress = false; |
|
|
|
|
_orientationCalUpsideDownSideInProgress = false; |
|
|
|
|
_orientationCalLeftSideInProgress = false; |
|
|
|
|
_orientationCalRightSideInProgress = false; |
|
|
|
|
_orientationCalNoseDownSideInProgress = false; |
|
|
|
|
_orientationCalTailDownSideInProgress = false; |
|
|
|
|
|
|
|
|
|
// Reset all visibility
|
|
|
|
|
_orientationCalDownSideVisible = false; |
|
|
|
|
_orientationCalUpsideDownSideVisible = false; |
|
|
|
|
_orientationCalLeftSideVisible = false; |
|
|
|
|
_orientationCalRightSideVisible = false; |
|
|
|
|
_orientationCalTailDownSideVisible = false; |
|
|
|
|
_orientationCalNoseDownSideVisible = false; |
|
|
|
|
|
|
|
|
|
_calTypeInProgress = CalTypeAccel; |
|
|
|
|
_orientationCalDownSideVisible = true; |
|
|
|
|
_orientationCalUpsideDownSideVisible = true; |
|
|
|
|
_orientationCalLeftSideVisible = true; |
|
|
|
|
_orientationCalRightSideVisible = true; |
|
|
|
|
_orientationCalTailDownSideVisible = true; |
|
|
|
|
_orientationCalNoseDownSideVisible = true; |
|
|
|
|
|
|
|
|
|
emit orientationCalSidesDoneChanged(); |
|
|
|
|
emit orientationCalSidesVisibleChanged(); |
|
|
|
|
emit orientationCalSidesInProgressChanged(); |
|
|
|
|
_updateAndEmitShowOrientationCalArea(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString placeVehicle("place vehicle "); |
|
|
|
|
if (_calTypeInProgress == CalTypeAccel && text.startsWith(placeVehicle)) { |
|
|
|
|
text = text.right(text.length() - placeVehicle.length()); |
|
|
|
|
if (text.startsWith("level")) { |
|
|
|
|
_orientationCalDownSideInProgress = true; |
|
|
|
|
_nextButton->setEnabled(true); |
|
|
|
|
} else if (text.startsWith("on its left")) { |
|
|
|
|
_orientationCalDownSideDone = true; |
|
|
|
|
_orientationCalDownSideInProgress = false; |
|
|
|
|
_orientationCalLeftSideInProgress = true; |
|
|
|
|
_progressBar->setProperty("value", (qreal)(17 / 100.0)); |
|
|
|
|
} else if (text.startsWith("on its right")) { |
|
|
|
|
_orientationCalLeftSideDone = true; |
|
|
|
|
_orientationCalLeftSideInProgress = false; |
|
|
|
|
_orientationCalRightSideInProgress = true; |
|
|
|
|
_progressBar->setProperty("value", (qreal)(34 / 100.0)); |
|
|
|
|
} else if (text.startsWith("nose down")) { |
|
|
|
|
_orientationCalRightSideDone = true; |
|
|
|
|
_orientationCalRightSideInProgress = false; |
|
|
|
|
_orientationCalNoseDownSideInProgress = true; |
|
|
|
|
_progressBar->setProperty("value", (qreal)(51 / 100.0)); |
|
|
|
|
} else if (text.startsWith("nose up")) { |
|
|
|
|
_orientationCalNoseDownSideDone = true; |
|
|
|
|
_orientationCalNoseDownSideInProgress = false; |
|
|
|
|
_orientationCalTailDownSideInProgress = true; |
|
|
|
|
_progressBar->setProperty("value", (qreal)(68 / 100.0)); |
|
|
|
|
} else if (text.startsWith("on its back")) { |
|
|
|
|
_orientationCalTailDownSideDone = true; |
|
|
|
|
_orientationCalTailDownSideInProgress = false; |
|
|
|
|
_orientationCalUpsideDownSideInProgress = true; |
|
|
|
|
_progressBar->setProperty("value", (qreal)(85 / 100.0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_orientationCalAreaHelpText->setProperty("text", tr("Hold still in the current orientation and press Next when ready")); |
|
|
|
|
|
|
|
|
|
emit orientationCalSidesDoneChanged(); |
|
|
|
|
emit orientationCalSidesInProgressChanged(); |
|
|
|
|
emit orientationCalSidesRotateChanged(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_appendStatusLog(originalMessageText); |
|
|
|
|
qCDebug(APMSensorsComponentControllerLog) << originalMessageText << severity; |
|
|
|
|
|
|
|
|
|
if (text.contains(QLatin1String("calibration successful"))) { |
|
|
|
|
_stopCalibration(StopCalibrationSuccess); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (text.startsWith(QStringLiteral("calibration cancelled"))) { |
|
|
|
|
_stopCalibration(_waitingForCancel ? StopCalibrationCancelled : StopCalibrationFailed); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (text.startsWith(QStringLiteral("calibration failed"))) { |
|
|
|
|
_stopCalibration(StopCalibrationFailed); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
|
|
|
|
if (text.contains(QLatin1Literal("progress <"))) { |
|
|
|
|
QString percent = text.split("<").last().split(">").first(); |
|
|
|
@ -533,6 +640,7 @@ void APMSensorsComponentController::_handleUASTextMessage(int uasId, int compId,
@@ -533,6 +640,7 @@ void APMSensorsComponentController::_handleUASTextMessage(int uasId, int compId,
|
|
|
|
|
_stopCalibration(StopCalibrationFailed); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void APMSensorsComponentController::_refreshParams(void) |
|
|
|
|