From cc9fa772c0be1aceadca4e43b0a6a91d61e1144e Mon Sep 17 00:00:00 2001 From: elafargue Date: Tue, 17 May 2011 22:23:08 +0200 Subject: [PATCH] Improvement: now the config output panel in the config gadget remains up to date all the time, no need to click on the "request" button after setting up the mixers. --- .../src/plugins/config/configoutputwidget.cpp | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index a534a0a5f..0879de42a 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -95,31 +95,18 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch6Rev << m_config->ch7Rev; - links << m_config->ch0Link - << m_config->ch1Link - << m_config->ch2Link - << m_config->ch3Link - << m_config->ch4Link - << m_config->ch5Link - << m_config->ch6Link - << m_config->ch7Link; + links << m_config->ch0Link + << m_config->ch1Link + << m_config->ch2Link + << m_config->ch3Link + << m_config->ch4Link + << m_config->ch5Link + << m_config->ch6Link + << m_config->ch7Link; -/* - UAVDataObject * obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); - QList fieldList = obj->getFields(); - foreach (UAVObjectField* field, fieldList) { - if (field->getUnits().contains("channel")) { - m_config->ch0Output->addItem(field->getName()); - m_config->ch1Output->addItem(field->getName()); - m_config->ch2Output->addItem(field->getName()); - m_config->ch3Output->addItem(field->getName()); - m_config->ch4Output->addItem(field->getName()); - m_config->ch5Output->addItem(field->getName()); - m_config->ch6Output->addItem(field->getName()); - m_config->ch7Output->addItem(field->getName()); - } - } - */ + // Register for ActuatorSettings changes: + UAVDataObject * obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestRCOutputUpdate())); for (int i = 0; i < 8; i++) { @@ -141,6 +128,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject())); connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate())); + + // Actually, this is not really needed since we are subscribing to the object updates already + // TODO: remove those buttons on all config gadget panels. connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate())); connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCOutputUpdate())); @@ -435,7 +425,6 @@ void ConfigOutputWidget::requestRCOutputUpdate() // Get the channel assignements: UAVDataObject * obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); Q_ASSERT(obj); - obj->requestUpdate(); QList fieldList = obj->getFields(); foreach (UAVObjectField* field, fieldList) { if (field->getUnits().contains("channel")) {