1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Merged in TheOtherCliff/librepilot/theothercliff/LP-135_aux_mag_calibration_issue (pull request #81)

LP-135 Aux mag calibration issue
This commit is contained in:
Alessio Morale 2015-10-01 23:12:14 +02:00
commit 04e31063d7
2 changed files with 20 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -62,8 +62,9 @@ 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: