mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-10 18:24:11 +01:00
Make revo calibration UI use teh configtaskwidget system
This commit is contained in:
parent
7c8700b4e5
commit
7f15e87890
@ -71,11 +71,14 @@ public:
|
||||
ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
|
||||
ConfigTaskWidget(parent),
|
||||
collectingData(false),
|
||||
position(-1),
|
||||
m_ui(new Ui_RevoSensorsWidget())
|
||||
position(-1)
|
||||
{
|
||||
m_ui = new Ui_RevoSensorsWidget();
|
||||
m_ui->setupUi(this);
|
||||
|
||||
addUAVObject("RevoCalibration");
|
||||
autoLoadWidgets();
|
||||
|
||||
// Initialization of the Paper plane widget
|
||||
m_ui->sixPointsHelp->setScene(new QGraphicsScene(this));
|
||||
|
||||
@ -209,10 +212,6 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
|
||||
// Connect the signals
|
||||
connect(m_ui->accelBiasStart, SIGNAL(clicked()), this, SLOT(launchAccelBiasCalibration()));
|
||||
|
||||
RevoCalibration * revoCalibration = RevoCalibration::GetInstance(getObjectManager());
|
||||
Q_ASSERT(revoCalibration);
|
||||
connect(revoCalibration, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues()));
|
||||
|
||||
connect(m_ui->revoCalSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(SettingsToRAM()));
|
||||
connect(m_ui->revoCalSettingsSaveSD, SIGNAL(clicked()), this, SLOT(SettingsToFlash()));
|
||||
connect(m_ui->sixPointsStart, SIGNAL(clicked()), this, SLOT(sixPointCalibrationMode()));
|
||||
@ -221,16 +220,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
|
||||
// Leave this timer permanently connected. The timer itself is started and stopped.
|
||||
connect(&progressBarTimer, SIGNAL(timeout()), this, SLOT(incrementProgress()));
|
||||
|
||||
// Order is important: 1st request the settings (it will also enable the controls)
|
||||
// then explicitely disable them. They will be re-enabled right afterwards by the
|
||||
// configgadgetwidget if the autopilot is actually connected.
|
||||
refreshValues();
|
||||
// when the AHRS Widget is instanciated, the autopilot is always connected // enableControls(false);
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
// Connect the help button
|
||||
connect(m_ui->Help, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
}
|
||||
|
||||
ConfigRevoWidget::~ConfigRevoWidget()
|
||||
@ -257,12 +247,6 @@ void ConfigRevoWidget::resizeEvent(QResizeEvent *event)
|
||||
}
|
||||
|
||||
|
||||
void ConfigRevoWidget::enableControls(bool enable)
|
||||
{
|
||||
//m_ui->ahrsSettingsSaveRAM->setEnabled(enable);
|
||||
m_ui->ahrsSettingsSaveSD->setEnabled(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
Starts an accelerometer bias calibration.
|
||||
*/
|
||||
@ -752,9 +736,10 @@ void ConfigRevoWidget::drawVariancesGraph()
|
||||
}
|
||||
|
||||
/**
|
||||
Request current settings from the AHRS
|
||||
* Called by the ConfigTaskWidget parent when RevoCalibration is updated
|
||||
* to update the UI
|
||||
*/
|
||||
void ConfigRevoWidget::refreshValues()
|
||||
void ConfigRevoWidget::refreshWidgetsValues(UAVObject *)
|
||||
{
|
||||
drawVariancesGraph();
|
||||
|
||||
@ -766,34 +751,6 @@ void ConfigRevoWidget::refreshValues()
|
||||
m_ui->calibInstructions->setText(QString("Press \"Start\" above to calibrate."));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Save current settings to RAM
|
||||
*/
|
||||
void ConfigRevoWidget::SettingsToRAM()
|
||||
{
|
||||
RevoCalibration * revoCalibration = RevoCalibration::GetInstance(getObjectManager());
|
||||
Q_ASSERT(revoCalibration);
|
||||
revoCalibration->updated();
|
||||
}
|
||||
|
||||
/**
|
||||
Save Revo calibration settings to flash
|
||||
*/
|
||||
void ConfigRevoWidget::SettingsToFlash()
|
||||
{
|
||||
SettingsToRAM();
|
||||
|
||||
RevoCalibration * revoCalibration = RevoCalibration::GetInstance(getObjectManager());
|
||||
Q_ASSERT(revoCalibration);
|
||||
saveObjectToSD(revoCalibration);
|
||||
}
|
||||
|
||||
void ConfigRevoWidget::openHelp()
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Revo+Configuration", QUrl::StrictMode) );
|
||||
}
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
|
@ -54,11 +54,10 @@ public:
|
||||
private:
|
||||
void drawVariancesGraph();
|
||||
void displayPlane(QString elementID);
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
Ui_RevoSensorsWidget *m_ui;
|
||||
QGraphicsSvgItem *paperplane;
|
||||
QGraphicsSvgItem *ahrsbargraph;
|
||||
QGraphicsSvgItem *sensorsBargraph;
|
||||
QGraphicsSvgItem *accel_x;
|
||||
QGraphicsSvgItem *accel_y;
|
||||
QGraphicsSvgItem *accel_z;
|
||||
@ -95,13 +94,10 @@ private:
|
||||
int position;
|
||||
|
||||
private slots:
|
||||
void openHelp();
|
||||
void launchAccelBiasCalibration();
|
||||
void incrementProgress();
|
||||
|
||||
virtual void refreshValues();
|
||||
void SettingsToRAM();
|
||||
void SettingsToFlash();
|
||||
virtual void refreshWidgetsValues(UAVObject * obj=NULL);
|
||||
void savePositionData();
|
||||
void computeScaleBias();
|
||||
void sixPointCalibrationMode();
|
||||
|
@ -670,6 +670,12 @@ new home location unless it is in indoor mode.</string>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>button:help</string>
|
||||
<string>url:http://wiki.openpilot.org/display/Doc/Revo+Configuration</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -683,6 +689,9 @@ specific calibration button on top of the screen.</string>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<string>button:apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -696,6 +705,9 @@ specific calibration button on top of the screen.</string>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<string>button:save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user