1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +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();
// Show instructions and enable controls
progressChanged(0);
displayInstructions((*currentSteps)[0].instructions, WizardModel::Prompt);
showHelp((*currentSteps)[0].visualHelp);
savePositionEnabledChanged(true);
@ -283,9 +284,20 @@ void SixPointCalibrationModel::getSample(UAVObject *obj)
}
}
if ((!calibratingAccel || (accel_accum_x.size() >= POINT_SAMPLE_SIZE)) &&
(!calibratingMag || (mag_accum_x.size() >= POINT_SAMPLE_SIZE / 10)) &&
(collectingData == true)) {
bool done = true;
float progress = 0;
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;
savePositionEnabledChanged(true);

View File

@ -59,6 +59,7 @@ signals:
void storeAndClearBoardRotation();
void recallBoardRotation();
void savePositionEnabledChanged(bool state);
void progressChanged(int value);
void displayVisualHelp(QString elementID);
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)));
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(progressChanged(int)), m_ui->accelProgress, SLOT(setValue(int)));
m_ui->accelSavePos->setEnabled(false);
// mag calibration
@ -121,6 +122,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
this, SLOT(addInstructions(QString, WizardModel::MessageType)));
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(progressChanged(int)), m_ui->magProgress, SLOT(setValue(int)));
m_ui->magSavePos->setEnabled(false);
// board level calibration

View File

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