mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-1150 UI for thermal calibration: add a completed state, some other fixes to FSM
This commit is contained in:
parent
3a5213ac9f
commit
25f75f0b8e
@ -50,21 +50,24 @@ ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) :
|
||||
m_setupState = new WizardState(tr("Setup board for calibration"), m_workingState);
|
||||
|
||||
m_acquisitionState = new WizardState(tr("*** Please Wait *** Samples acquisition, this can take several minutes"), m_workingState);
|
||||
m_restoreState = new WizardState(tr("Restore board settings"), m_workingState);
|
||||
m_calculateState = new WizardState(tr("Calculate calibration matrix"), m_workingState);
|
||||
m_finalizeState = new WizardState(tr("Completed"), m_workingState);
|
||||
|
||||
m_abortState = new WizardState("Canceled", this);
|
||||
|
||||
m_completedState = new WizardState("Completed", this);
|
||||
setTransitions();
|
||||
|
||||
connect(m_helper, SIGNAL(gradientChanged(float)), this, SLOT(setTemperatureGradient(float)));
|
||||
connect(m_helper, SIGNAL(temperatureChanged(float)), this, SLOT(setTemperature(float)));
|
||||
connect(m_helper, SIGNAL(processPercentageChanged(int)), this, SLOT(setProgress(int)));
|
||||
|
||||
connect(m_readyState, SIGNAL(entered()), this, SLOT(wizardReady()));
|
||||
connect(m_readyState, SIGNAL(exited()), this, SLOT(wizardStarted()));
|
||||
connect(m_completedState, SIGNAL(entered()), this, SLOT(wizardReady()));
|
||||
connect(m_completedState, SIGNAL(exited()), this, SLOT(wizardStarted()));
|
||||
this->setInitialState(m_readyState);
|
||||
m_steps << m_readyState
|
||||
<< m_setupState
|
||||
<< m_acquisitionState << m_calculateState << m_finalizeState;
|
||||
|
||||
m_steps << m_readyState << m_saveSettingState << m_setupState << m_acquisitionState << m_restoreState << m_calculateState;
|
||||
}
|
||||
void ThermalCalibrationModel::init()
|
||||
{
|
||||
@ -84,6 +87,7 @@ void ThermalCalibrationModel::stepChanged(WizardState *state) {
|
||||
void ThermalCalibrationModel::setTransitions()
|
||||
{
|
||||
m_readyState->addTransition(this, SIGNAL(next()), m_workingState);
|
||||
m_completedState->addTransition(this, SIGNAL(next()), m_workingState);
|
||||
// handles board status save
|
||||
// Ready->WorkingState->saveSettings->setup
|
||||
m_saveSettingState->addTransition(new BoardStatusSaveTransition(m_helper, m_saveSettingState, m_setupState));
|
||||
@ -92,15 +96,13 @@ void ThermalCalibrationModel::setTransitions()
|
||||
m_setupState->addTransition(new BoardSetupTransition(m_helper, m_setupState, m_acquisitionState));
|
||||
|
||||
// acquisition -revertSettings-> calculation
|
||||
// m_acquisitionState->addTransition(this,SIGNAL(next()),m_calculateState);
|
||||
// revert settings after acquisition is completed
|
||||
// m_acquisitionState->addTransition(new BoardStatusRestoreTransition(m_helper, m_acquisitionState, m_calculateState));
|
||||
m_acquisitionState->addTransition(new DataAcquisitionTransition(m_helper, m_acquisitionState, m_calculateState));
|
||||
m_workingState->addTransition(m_helper, SIGNAL(abort()), m_abortState) ;
|
||||
m_calculateState->addTransition(new BoardStatusRestoreTransition(m_helper, m_calculateState, m_finalizeState));
|
||||
|
||||
m_acquisitionState->addTransition(new DataAcquisitionTransition(m_helper, m_acquisitionState, m_restoreState ));
|
||||
m_restoreState ->addTransition(new BoardStatusRestoreTransition(m_helper, m_restoreState, m_calculateState));
|
||||
m_calculateState->addTransition(new CompensationCalculationTransition(m_helper, m_calculateState, m_completedState));
|
||||
m_abortState->addTransition(new BoardStatusRestoreTransition(m_helper, m_abortState, m_readyState));
|
||||
m_finalizeState->addTransition(this, SIGNAL(next()), m_readyState);
|
||||
m_workingState->addTransition(m_helper, SIGNAL(abort()), m_abortState) ;
|
||||
// Ready
|
||||
}
|
||||
}
|
||||
|
@ -152,13 +152,16 @@ private:
|
||||
WizardState *m_setupState;
|
||||
// Acquire samples
|
||||
WizardState *m_acquisitionState;
|
||||
// Restore initial settings after acquisition
|
||||
WizardState *m_restoreState;
|
||||
// Calculate calibration parameters
|
||||
WizardState *m_calculateState;
|
||||
// Save calibration and restore board settings
|
||||
WizardState *m_finalizeState;
|
||||
// revert board settings if something goes wrong
|
||||
WizardState *m_abortState;
|
||||
|
||||
// just the same as readystate, but it is reached after havign completed the calibration
|
||||
WizardState *m_completedState;
|
||||
void setTransitions();
|
||||
|
||||
|
||||
@ -185,13 +188,23 @@ public slots:
|
||||
void btnEnd()
|
||||
{
|
||||
// emit previous();
|
||||
m_helper->endAcquisition();
|
||||
m_helper->stopAcquisition();
|
||||
}
|
||||
|
||||
void btnAbort()
|
||||
{
|
||||
emit abort();
|
||||
}
|
||||
void wizardReady(){
|
||||
setStartEnabled(true);
|
||||
setEndEnabled(false);
|
||||
setCancelEnabled(false);
|
||||
}
|
||||
void wizardStarted(){
|
||||
setStartEnabled(false);
|
||||
setEndEnabled(true);
|
||||
setCancelEnabled(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "wizardstate.h"
|
||||
|
||||
#include "QDebug"
|
||||
WizardState::WizardState(QString name, QState *parent) :
|
||||
QState(parent)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user