Browse Source

Reset internal state correctly

This fixes rotate images showing up at the wrong time
QGC4.4
Don Gagne 9 years ago
parent
commit
a0e0350188
  1. 46
      src/AutoPilotPlugins/PX4/SensorsComponentController.cc
  2. 4
      src/AutoPilotPlugins/PX4/SensorsComponentController.h

46
src/AutoPilotPlugins/PX4/SensorsComponentController.cc

@ -32,6 +32,8 @@ @@ -32,6 +32,8 @@
#include <QVariant>
#include <QQmlProperty>
QGC_LOGGING_CATEGORY(SensorsComponentControllerLog, "SensorsComponentControllerLog")
SensorsComponentController::SensorsComponentController(void) :
_statusLog(NULL),
_progressBar(NULL),
@ -106,10 +108,38 @@ void SensorsComponentController::_startVisualCalibration(void) @@ -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 @@ -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 @@ -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

4
src/AutoPilotPlugins/PX4/SensorsComponentController.h

@ -32,6 +32,9 @@ @@ -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: @@ -115,6 +118,7 @@ private:
void _appendStatusLog(const QString& text);
void _refreshParams(void);
void _hideAllCalAreas(void);
void _resetInternalState(void);
enum StopCalibrationCode {
StopCalibrationSuccess,

Loading…
Cancel
Save