Commit a0e03501 authored by Don Gagne's avatar Don Gagne

Reset internal state correctly

This fixes rotate images showing up at the wrong time
parent a1f444e8
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <QVariant> #include <QVariant>
#include <QQmlProperty> #include <QQmlProperty>
QGC_LOGGING_CATEGORY(SensorsComponentControllerLog, "SensorsComponentControllerLog")
SensorsComponentController::SensorsComponentController(void) : SensorsComponentController::SensorsComponentController(void) :
_statusLog(NULL), _statusLog(NULL),
_progressBar(NULL), _progressBar(NULL),
...@@ -107,21 +109,13 @@ void SensorsComponentController::_startVisualCalibration(void) ...@@ -107,21 +109,13 @@ void SensorsComponentController::_startVisualCalibration(void)
_levelButton->setEnabled(false); _levelButton->setEnabled(false);
_cancelButton->setEnabled(true); _cancelButton->setEnabled(true);
_resetInternalState();
_progressBar->setProperty("value", 0); _progressBar->setProperty("value", 0);
} }
void SensorsComponentController::_stopCalibration(SensorsComponentController::StopCalibrationCode code) void SensorsComponentController::_resetInternalState(void)
{ {
disconnect(_uas, &UASInterface::textMessageReceived, this, &SensorsComponentController::_handleUASTextMessage);
_compassButton->setEnabled(true);
_gyroButton->setEnabled(true);
_accelButton->setEnabled(true);
_airspeedButton->setEnabled(true);
_levelButton->setEnabled(true);
_cancelButton->setEnabled(false);
if (code == StopCalibrationSuccess) {
_orientationCalDownSideDone = true; _orientationCalDownSideDone = true;
_orientationCalUpsideDownSideDone = true; _orientationCalUpsideDownSideDone = true;
_orientationCalLeftSideDone = true; _orientationCalLeftSideDone = true;
...@@ -134,8 +128,31 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St ...@@ -134,8 +128,31 @@ void SensorsComponentController::_stopCalibration(SensorsComponentController::St
_orientationCalRightSideInProgress = false; _orientationCalRightSideInProgress = false;
_orientationCalNoseDownSideInProgress = false; _orientationCalNoseDownSideInProgress = false;
_orientationCalTailDownSideInProgress = false; _orientationCalTailDownSideInProgress = false;
_orientationCalDownSideRotate = false;
_orientationCalUpsideDownSideRotate = false;
_orientationCalLeftSideRotate = false;
_orientationCalRightSideRotate = false;
_orientationCalNoseDownSideRotate = false;
_orientationCalTailDownSideRotate = false;
emit orientationCalSidesRotateChanged();
emit orientationCalSidesDoneChanged(); emit orientationCalSidesDoneChanged();
emit orientationCalSidesInProgressChanged(); emit orientationCalSidesInProgressChanged();
}
void SensorsComponentController::_stopCalibration(SensorsComponentController::StopCalibrationCode code)
{
disconnect(_uas, &UASInterface::textMessageReceived, this, &SensorsComponentController::_handleUASTextMessage);
_compassButton->setEnabled(true);
_gyroButton->setEnabled(true);
_accelButton->setEnabled(true);
_airspeedButton->setEnabled(true);
_levelButton->setEnabled(true);
_cancelButton->setEnabled(false);
if (code == StopCalibrationSuccess) {
_resetInternalState();
_progressBar->setProperty("value", 1); _progressBar->setProperty("value", 1);
} else { } else {
...@@ -226,6 +243,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in ...@@ -226,6 +243,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
} }
_appendStatusLog(text); _appendStatusLog(text);
qCDebug(SensorsComponentControllerLog) << text;
if (_unknownFirmwareVersion) { if (_unknownFirmwareVersion) {
// We don't know how to do visual cal with the version of firwmare // We don't know how to do visual cal with the version of firwmare
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include "UASInterface.h" #include "UASInterface.h"
#include "FactPanelController.h" #include "FactPanelController.h"
#include "QGCLoggingCategory.h"
Q_DECLARE_LOGGING_CATEGORY(SensorsComponentControllerLog)
/// Sensors Component MVC Controller for SensorsComponent.qml. /// Sensors Component MVC Controller for SensorsComponent.qml.
class SensorsComponentController : public FactPanelController class SensorsComponentController : public FactPanelController
...@@ -115,6 +118,7 @@ private: ...@@ -115,6 +118,7 @@ private:
void _appendStatusLog(const QString& text); void _appendStatusLog(const QString& text);
void _refreshParams(void); void _refreshParams(void);
void _hideAllCalAreas(void); void _hideAllCalAreas(void);
void _resetInternalState(void);
enum StopCalibrationCode { enum StopCalibrationCode {
StopCalibrationSuccess, StopCalibrationSuccess,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment