diff --git a/ground/src/plugins/config/ahrs.ui b/ground/src/plugins/config/ahrs.ui index dac374e73..b25c9a142 100644 --- a/ground/src/plugins/config/ahrs.ui +++ b/ground/src/plugins/config/ahrs.ui @@ -34,7 +34,7 @@ 10 10 341 - 141 + 131 @@ -100,7 +100,7 @@ Hint: run this with engines at cruising speed. 10 - 390 + 380 111 17 @@ -113,7 +113,7 @@ Hint: run this with engines at cruising speed. 140 - 380 + 370 131 31 @@ -171,14 +171,14 @@ Hint: run this with engines at cruising speed. - + false - 310 - 380 + 320 + 370 201 22 @@ -254,9 +254,9 @@ specific calibration button on top of the screen. - 360 + 370 10 - 271 + 251 17 @@ -302,6 +302,19 @@ specific calibration button on top of the screen. Save Position + + + + 320 + 400 + 201 + 22 + + + + Indoor flight mode + + diff --git a/ground/src/plugins/config/configahrswidget.cpp b/ground/src/plugins/config/configahrswidget.cpp index 9d8c9b46c..defccc3ae 100644 --- a/ground/src/plugins/config/configahrswidget.cpp +++ b/ground/src/plugins/config/configahrswidget.cpp @@ -187,7 +187,7 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent) connect(m_ahrs->ahrsSettingsRequest, SIGNAL(clicked()), this, SLOT(ahrsSettingsRequest())); connect(m_ahrs->ahrsSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveRAM())); connect(m_ahrs->ahrsSettingsSaveSD, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveSD())); - connect(m_ahrs->sixPointsStart, SIGNAL(clicked()), this, SLOT(calibrationMode())); + connect(m_ahrs->sixPointsStart, SIGNAL(clicked()), this, SLOT(sixPointCalibrationMode())); connect(m_ahrs->sixPointsSave, SIGNAL(clicked()), this, SLOT(savePositionData())); connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest())); @@ -350,6 +350,7 @@ void ConfigAHRSWidget::attitudeRawUpdated(UAVObject * obj) computeScaleBias(); m_ahrs->sixPointsStart->setEnabled(true); m_ahrs->sixPointsSave->setEnabled(false); + saveAHRSCalibration(); // Saves the result to SD. /* Cleanup original settings */ obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSSettings"))); @@ -521,7 +522,10 @@ void ConfigAHRSWidget::computeScaleBias() } -void ConfigAHRSWidget::calibrationMode() +/** + Six point calibration mode + */ +void ConfigAHRSWidget::sixPointCalibrationMode() { UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); @@ -619,8 +623,15 @@ void ConfigAHRSWidget::ahrsSettingsRequest() UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSSettings"))); obj->requestUpdate(); UAVObjectField *field = obj->getField(QString("Algorithm")); - m_ahrs->algorithm->setCurrentIndex(m_ahrs->algorithm->findText(field->getValue().toString())); + if (field) + m_ahrs->algorithm->setCurrentIndex(m_ahrs->algorithm->findText(field->getValue().toString())); drawVariancesGraph(); + + obj = dynamic_cast(getObjectManager()->getObject(QString("HomeLocation"))); + field = obj->getField(QString("Indoor")); + if (field) + m_ahrs->homeLocation->setEnabled(field->getValue().toBool()); + m_ahrs->ahrsCalibStart->setEnabled(true); m_ahrs->sixPointsStart->setEnabled(true); m_ahrs->calibInstructions->setText(QString("Press \"Start\" above to calibrate.")); diff --git a/ground/src/plugins/config/configahrswidget.h b/ground/src/plugins/config/configahrswidget.h index c20464d45..d206f7d60 100644 --- a/ground/src/plugins/config/configahrswidget.h +++ b/ground/src/plugins/config/configahrswidget.h @@ -100,7 +100,7 @@ private slots: void ahrsSettingsSaveSD(); void savePositionData(); void computeScaleBias(); - void calibrationMode(); + void sixPointCalibrationMode(); void attitudeRawUpdated(UAVObject * obj); protected: void showEvent(QShowEvent *event);