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

OP-1351 added progress bar for sixpoint calibration

This commit is contained in:
Philippe Renon 2014-06-01 12:45:35 +02:00
parent 0b108ecf04
commit 2a1e2436eb
4 changed files with 26 additions and 23 deletions

View File

@ -211,6 +211,7 @@ void SixPointCalibrationModel::start(bool calibrateAccel, bool calibrateMag)
started(); started();
// Show instructions and enable controls // Show instructions and enable controls
progressChanged(0);
displayInstructions((*currentSteps)[0].instructions, WizardModel::Prompt); displayInstructions((*currentSteps)[0].instructions, WizardModel::Prompt);
showHelp((*currentSteps)[0].visualHelp); showHelp((*currentSteps)[0].visualHelp);
savePositionEnabledChanged(true); savePositionEnabledChanged(true);
@ -283,9 +284,20 @@ void SixPointCalibrationModel::getSample(UAVObject *obj)
} }
} }
if ((!calibratingAccel || (accel_accum_x.size() >= POINT_SAMPLE_SIZE)) && bool done = true;
(!calibratingMag || (mag_accum_x.size() >= POINT_SAMPLE_SIZE / 10)) && float progress = 0;
(collectingData == true)) { if (calibratingAccel) {
done = (accel_accum_x.size() >= POINT_SAMPLE_SIZE);
progress = (float)accel_accum_x.size() / (float)POINT_SAMPLE_SIZE;
}
if (calibratingMag) {
done = (mag_accum_x.size() >= POINT_SAMPLE_SIZE / 10);
progress = (float)mag_accum_x.size() / (float)(POINT_SAMPLE_SIZE / 10);
}
progressChanged(progress * 100);
if (collectingData && done) {
collectingData = false; collectingData = false;
savePositionEnabledChanged(true); savePositionEnabledChanged(true);

View File

@ -59,6 +59,7 @@ signals:
void storeAndClearBoardRotation(); void storeAndClearBoardRotation();
void recallBoardRotation(); void recallBoardRotation();
void savePositionEnabledChanged(bool state); void savePositionEnabledChanged(bool state);
void progressChanged(int value);
void displayVisualHelp(QString elementID); void displayVisualHelp(QString elementID);
void displayInstructions(QString text, WizardModel::MessageType type = WizardModel::Info); void displayInstructions(QString text, WizardModel::MessageType type = WizardModel::Info);

View File

@ -106,6 +106,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
this, SLOT(addInstructions(QString, WizardModel::MessageType))); this, SLOT(addInstructions(QString, WizardModel::MessageType)));
connect(m_accelCalibrationModel, SIGNAL(displayVisualHelp(QString)), this, SLOT(displayVisualHelp(QString))); connect(m_accelCalibrationModel, SIGNAL(displayVisualHelp(QString)), this, SLOT(displayVisualHelp(QString)));
connect(m_accelCalibrationModel, SIGNAL(savePositionEnabledChanged(bool)), m_ui->accelSavePos, SLOT(setEnabled(bool))); connect(m_accelCalibrationModel, SIGNAL(savePositionEnabledChanged(bool)), m_ui->accelSavePos, SLOT(setEnabled(bool)));
connect(m_accelCalibrationModel, SIGNAL(progressChanged(int)), m_ui->accelProgress, SLOT(setValue(int)));
m_ui->accelSavePos->setEnabled(false); m_ui->accelSavePos->setEnabled(false);
// mag calibration // mag calibration
@ -121,6 +122,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
this, SLOT(addInstructions(QString, WizardModel::MessageType))); this, SLOT(addInstructions(QString, WizardModel::MessageType)));
connect(m_magCalibrationModel, SIGNAL(displayVisualHelp(QString)), this, SLOT(displayVisualHelp(QString))); connect(m_magCalibrationModel, SIGNAL(displayVisualHelp(QString)), this, SLOT(displayVisualHelp(QString)));
connect(m_magCalibrationModel, SIGNAL(savePositionEnabledChanged(bool)), m_ui->magSavePos, SLOT(setEnabled(bool))); connect(m_magCalibrationModel, SIGNAL(savePositionEnabledChanged(bool)), m_ui->magSavePos, SLOT(setEnabled(bool)));
connect(m_magCalibrationModel, SIGNAL(progressChanged(int)), m_ui->magProgress, SLOT(setValue(int)));
m_ui->magSavePos->setEnabled(false); m_ui->magSavePos->setEnabled(false);
// board level calibration // board level calibration

View File

@ -127,17 +127,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_thermalbias_2"> <widget class="QProgressBar" name="accelProgress">
<property name="orientation"> <property name="value">
<enum>Qt::Horizontal</enum> <number>0</number>
</property> </property>
<property name="sizeHint" stdset="0"> </widget>
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="accelSavePos"> <widget class="QPushButton" name="accelSavePos">
@ -175,17 +169,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_4"> <widget class="QProgressBar" name="magProgress">
<property name="orientation"> <property name="value">
<enum>Qt::Horizontal</enum> <number>0</number>
</property> </property>
<property name="sizeHint" stdset="0"> </widget>
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="magSavePos"> <widget class="QPushButton" name="magSavePos">