From 554a190f7821c663077354ea68ffca99c51a074c Mon Sep 17 00:00:00 2001 From: Cliff Geerdes Date: Tue, 29 Sep 2015 02:09:18 -0400 Subject: [PATCH] LP-135 simple port of fix to 15.09 --- .../src/plugins/config/configrevowidget.cpp | 18 ++++++++++++++++++ .../gcs/src/plugins/config/configrevowidget.h | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ground/gcs/src/plugins/config/configrevowidget.cpp b/ground/gcs/src/plugins/config/configrevowidget.cpp index b483f7190..87c1bc29a 100644 --- a/ground/gcs/src/plugins/config/configrevowidget.cpp +++ b/ground/gcs/src/plugins/config/configrevowidget.cpp @@ -241,6 +241,16 @@ void ConfigRevoWidget::storeAndClearBoardRotation() data.BoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = 0; data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = 0; attitudeSettings->setData(data); + + // Store current aux mag board rotation + AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager()); + Q_ASSERT(auxMagSettings); + AuxMagSettings::DataFields auxMagData = auxMagSettings->getData(); + auxMagStoredBoardRotation = auxMagData.Orientation; + + // Set aux mag board rotation to no rotation + auxMagData.Orientation = 0.0f; + auxMagSettings->setData(auxMagData); } } @@ -250,6 +260,7 @@ void ConfigRevoWidget::recallBoardRotation() // Recall current board rotation isBoardRotationStored = false; + // Restore the flight controller board rotation AttitudeSettings *attitudeSettings = AttitudeSettings::GetInstance(getObjectManager()); Q_ASSERT(attitudeSettings); AttitudeSettings::DataFields data = attitudeSettings->getData(); @@ -257,6 +268,13 @@ void ConfigRevoWidget::recallBoardRotation() data.BoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL]; data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH]; attitudeSettings->setData(data); + + // Restore the aux mag board rotation + AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager()); + Q_ASSERT(auxMagSettings); + AuxMagSettings::DataFields auxMagData = auxMagSettings->getData(); + auxMagData.Orientation = auxMagStoredBoardRotation; + auxMagSettings->setData(auxMagData); } } diff --git a/ground/gcs/src/plugins/config/configrevowidget.h b/ground/gcs/src/plugins/config/configrevowidget.h index 5b19aa548..1d10c49b6 100644 --- a/ground/gcs/src/plugins/config/configrevowidget.h +++ b/ground/gcs/src/plugins/config/configrevowidget.h @@ -62,8 +62,10 @@ private: Ui_RevoSensorsWidget *m_ui; - // Board rotation store/recall + // Board rotation store/recall for FC and for aux mag + qint16 storedBoardRotation[3]; + float auxMagStoredBoardRotation; bool isBoardRotationStored; private slots: