diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc index 77693e7c3734e568cce51c6f942ae688926f248f..583dc6963e88e19ec8a87af2259115ce33bdaf21 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc @@ -32,6 +32,8 @@ #include #include +QGC_LOGGING_CATEGORY(SensorsComponentControllerLog, "SensorsComponentControllerLog") + SensorsComponentController::SensorsComponentController(void) : _statusLog(NULL), _progressBar(NULL), @@ -106,10 +108,38 @@ void SensorsComponentController::_startVisualCalibration(void) _airspeedButton->setEnabled(false); _levelButton->setEnabled(false); _cancelButton->setEnabled(true); + + _resetInternalState(); _progressBar->setProperty("value", 0); } +void SensorsComponentController::_resetInternalState(void) +{ + _orientationCalDownSideDone = true; + _orientationCalUpsideDownSideDone = true; + _orientationCalLeftSideDone = true; + _orientationCalRightSideDone = true; + _orientationCalTailDownSideDone = true; + _orientationCalNoseDownSideDone = true; + _orientationCalDownSideInProgress = false; + _orientationCalUpsideDownSideInProgress = false; + _orientationCalLeftSideInProgress = false; + _orientationCalRightSideInProgress = false; + _orientationCalNoseDownSideInProgress = false; + _orientationCalTailDownSideInProgress = false; + _orientationCalDownSideRotate = false; + _orientationCalUpsideDownSideRotate = false; + _orientationCalLeftSideRotate = false; + _orientationCalRightSideRotate = false; + _orientationCalNoseDownSideRotate = false; + _orientationCalTailDownSideRotate = false; + + emit orientationCalSidesRotateChanged(); + emit orientationCalSidesDoneChanged(); + emit orientationCalSidesInProgressChanged(); +} + void SensorsComponentController::_stopCalibration(SensorsComponentController::StopCalibrationCode code) { disconnect(_uas, &UASInterface::textMessageReceived, this, &SensorsComponentController::_handleUASTextMessage); @@ -122,20 +152,7 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St _cancelButton->setEnabled(false); if (code == StopCalibrationSuccess) { - _orientationCalDownSideDone = true; - _orientationCalUpsideDownSideDone = true; - _orientationCalLeftSideDone = true; - _orientationCalRightSideDone = true; - _orientationCalTailDownSideDone = true; - _orientationCalNoseDownSideDone = true; - _orientationCalDownSideInProgress = false; - _orientationCalUpsideDownSideInProgress = false; - _orientationCalLeftSideInProgress = false; - _orientationCalRightSideInProgress = false; - _orientationCalNoseDownSideInProgress = false; - _orientationCalTailDownSideInProgress = false; - emit orientationCalSidesDoneChanged(); - emit orientationCalSidesInProgressChanged(); + _resetInternalState(); _progressBar->setProperty("value", 1); } else { @@ -226,6 +243,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in } _appendStatusLog(text); + qCDebug(SensorsComponentControllerLog) << text; if (_unknownFirmwareVersion) { // We don't know how to do visual cal with the version of firwmare diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.h b/src/AutoPilotPlugins/PX4/SensorsComponentController.h index be4021eeffcd1e98188532a231351c0fbab461de..b8498d482f5eb403bf15c4146d5a77e1a6d87142 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentController.h +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.h @@ -32,6 +32,9 @@ #include "UASInterface.h" #include "FactPanelController.h" +#include "QGCLoggingCategory.h" + +Q_DECLARE_LOGGING_CATEGORY(SensorsComponentControllerLog) /// Sensors Component MVC Controller for SensorsComponent.qml. class SensorsComponentController : public FactPanelController @@ -115,6 +118,7 @@ private: void _appendStatusLog(const QString& text); void _refreshParams(void); void _hideAllCalAreas(void); + void _resetInternalState(void); enum StopCalibrationCode { StopCalibrationSuccess,