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

Only one output configuration at a time is now able to receive user input while the test outputs is enabled.

This commit is contained in:
zedamota 2011-10-16 00:57:59 +01:00
parent 08e077e8cb
commit cfbfbe1209
2 changed files with 22 additions and 3 deletions

View File

@ -39,7 +39,7 @@
#include <QDesktopServices>
#include <QUrl>
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent)
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent),wasItMe(false)
{
m_config = new Ui_OutputWidget();
m_config->setupUi(this);
@ -168,6 +168,12 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
addWidget(m_config->ch7OutMax);
addWidget(m_config->ch7Rev);
addWidget(m_config->spinningArmed);
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVObject* obj = objManager->getObject(QString("ActuatorCommand"));
if(obj->getMetadata().gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_ONCHANGE)
this->setEnabled(false);
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(disableIfNotMe(UAVObject*)));
}
ConfigOutputWidget::~ConfigOutputWidget()
@ -237,6 +243,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
UAVObject::Metadata mdata = obj->getMetadata();
if (state)
{
wasItMe=true;
accInitialData = mdata;
mdata.flightAccess = UAVObject::ACCESS_READONLY;
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
@ -256,6 +263,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
}
else
{
wasItMe=false;
mdata = accInitialData; // Restore metadata
foreach (QSpinBox* box, outMin) {
box->setEnabled(true);
@ -266,6 +274,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
}
obj->setMetadata(mdata);
obj->updated();
}
@ -583,4 +592,13 @@ void ConfigOutputWidget::openHelp()
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Output+Configuration", QUrl::StrictMode) );
}
void ConfigOutputWidget::disableIfNotMe(UAVObject* obj)
{
if(obj->getMetadata().gcsTelemetryUpdateMode == UAVObject::UPDATEMODE_ONCHANGE)
{
if(!wasItMe)
this->setEnabled(false);
}
else
this->setEnabled(true);
}

View File

@ -69,8 +69,9 @@ private:
bool firstUpdate;
bool wasItMe;
private slots:
void disableIfNotMe(UAVObject *obj);
virtual void refreshWidgetsValues();
void updateObjectsFromWidgets();
void runChannelTests(bool state);