1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-06 21:54:15 +01:00

LP-135 simple port of fix to 15.09

This commit is contained in:
Cliff Geerdes 2015-09-29 02:09:18 -04:00
parent bf07f53e87
commit 554a190f78
2 changed files with 21 additions and 1 deletions

View File

@ -241,6 +241,16 @@ void ConfigRevoWidget::storeAndClearBoardRotation()
data.BoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = 0; data.BoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = 0;
data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = 0; data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = 0;
attitudeSettings->setData(data); 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 // Recall current board rotation
isBoardRotationStored = false; isBoardRotationStored = false;
// Restore the flight controller board rotation
AttitudeSettings *attitudeSettings = AttitudeSettings::GetInstance(getObjectManager()); AttitudeSettings *attitudeSettings = AttitudeSettings::GetInstance(getObjectManager());
Q_ASSERT(attitudeSettings); Q_ASSERT(attitudeSettings);
AttitudeSettings::DataFields data = attitudeSettings->getData(); 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_ROLL] = storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL];
data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH]; data.BoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH];
attitudeSettings->setData(data); 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);
} }
} }

View File

@ -62,8 +62,10 @@ private:
Ui_RevoSensorsWidget *m_ui; Ui_RevoSensorsWidget *m_ui;
// Board rotation store/recall // Board rotation store/recall for FC and for aux mag
qint16 storedBoardRotation[3]; qint16 storedBoardRotation[3];
float auxMagStoredBoardRotation;
bool isBoardRotationStored; bool isBoardRotationStored;
private slots: private slots: