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

OP-1351 thermal calibration - added Debug message type and used it to stop displaying some status messages

This commit is contained in:
Philippe Renon 2014-06-11 01:07:00 +02:00
parent 4a6c417bda
commit e596f2ea90
5 changed files with 34 additions and 21 deletions

View File

@ -72,7 +72,7 @@ public:
public slots:
void enterState()
{
m_helper->addInstructions(tr("Configuring board for calibration."));
m_helper->addInstructions(tr("Configuring board for calibration."), WizardModel::Debug);
m_helper->setupBoard();
}

View File

@ -67,7 +67,7 @@ public:
public slots:
void enterState()
{
m_helper->addInstructions("Calculating calibration data.");
m_helper->addInstructions("Calculating calibration data.", WizardModel::Debug);
m_helper->calculate();
}

View File

@ -72,7 +72,7 @@ public:
public slots:
void enterState()
{
m_helper->addInstructions(tr("Saving initial settings."));
m_helper->addInstructions(tr("Saving initial settings."), WizardModel::Debug);
m_helper->statusSave();
}
@ -112,7 +112,7 @@ public:
public slots:
void enterState()
{
m_helper->addInstructions(tr("Restoring board configuration."));
m_helper->addInstructions(tr("Restoring board configuration."), WizardModel::Debug);
m_helper->endAcquisition();
m_helper->statusRestore();
}

View File

@ -40,7 +40,7 @@ class WizardModel : public QStateMachine {
Q_PROPERTY(WizardState * currentState READ currentState NOTIFY currentStateChanged)
public:
enum MessageType { Info, Prompt, Warn, Success, Failure };
enum MessageType { Debug, Info, Prompt, Warn, Success, Failure };
explicit WizardModel(QObject *parent = 0);

View File

@ -56,6 +56,8 @@
#define sign(x) ((x < 0) ? -1 : 1)
//#define DEBUG
// Uncomment this to enable 6 point calibration on the accels
#define NOISE_SAMPLES 50
@ -268,26 +270,37 @@ void ConfigRevoWidget::displayVisualHelp(QString elementID)
void ConfigRevoWidget::clearInstructions()
{
m_ui->calibrationInstructions->clear();
// addInstructions(tr("Press any Start button to start a calibration step."), WizardModel::Prompt);
}
void ConfigRevoWidget::addInstructions(QString text, WizardModel::MessageType type)
{
if (!text.isNull()) {
switch (type) {
case WizardModel::Prompt:
text = QString("<b><font color='blue'>%1</font>").arg(text);
break;
case WizardModel::Success:
text = QString("<b><font color='green'>%1</font>").arg(text);
break;
case WizardModel::Failure:
text = QString("<b><font color='red'>%1</font>").arg(text);
break;
default:
break;
}
m_ui->calibrationInstructions->append(text);
QString msg;
switch (type) {
case WizardModel::Debug:
#ifdef DEBUG
msg = QString("<i>%1</i>").arg(text);
#endif
break;
case WizardModel::Info:
msg = QString("%1").arg(text);
break;
case WizardModel::Prompt:
msg = QString("<b><font color='blue'>%1</font>").arg(text);
break;
case WizardModel::Warn:
msg = QString("<b>%1</b>").arg(text);
break;
case WizardModel::Success:
msg = QString("<b><font color='green'>%1</font>").arg(text);
break;
case WizardModel::Failure:
msg = QString("<b><font color='red'>%1</font>").arg(text);
break;
default:
break;
}
if (!msg.isEmpty()) {
m_ui->calibrationInstructions->append(msg);
}
}