Commit 189135d4 authored by tstellanova's avatar tstellanova

Fixing inter-object wiring

parent e8c6dbb2
...@@ -13,6 +13,12 @@ QGCUASParamManager::QGCUASParamManager(UASInterface* uas, QWidget *parent) : ...@@ -13,6 +13,12 @@ QGCUASParamManager::QGCUASParamManager(UASInterface* uas, QWidget *parent) :
{ {
paramDataModel = uas->getParamDataModel(); paramDataModel = uas->getParamDataModel();
uas->setParamManager(this); uas->setParamManager(this);
// Connect retransmission guard
connect(this, SIGNAL(parameterUpdateRequested(int,QString)), this, SLOT(requestParameterUpdate(int,QString)));
connect(this, SIGNAL(parameterUpdateRequestedById(int,int)), mav, SLOT(requestParameter(int,int)));
} }
...@@ -29,6 +35,10 @@ void QGCUASParamManager::requestParameterUpdate(int component, const QString& pa ...@@ -29,6 +35,10 @@ void QGCUASParamManager::requestParameterUpdate(int component, const QString& pa
} }
} }
/** /**
* Send a request to deliver the list of onboard parameters * Send a request to deliver the list of onboard parameters
* to the MAV. * to the MAV.
...@@ -132,7 +142,7 @@ void QGCUASParamManager::retransmissionGuardTick() ...@@ -132,7 +142,7 @@ void QGCUASParamManager::retransmissionGuardTick()
if (count < retransmissionBurstRequestSize) { if (count < retransmissionBurstRequestSize) {
//qDebug() << __FILE__ << __LINE__ << "RETRANSMISSION GUARD REQUESTS RETRANSMISSION OF PARAM #" << id << "FROM COMPONENT #" << component; //qDebug() << __FILE__ << __LINE__ << "RETRANSMISSION GUARD REQUESTS RETRANSMISSION OF PARAM #" << id << "FROM COMPONENT #" << component;
//TODO mavlink msg type for "request parameter set" ? //TODO mavlink msg type for "request parameter set" ?
emit requestParameter(component, id); emit parameterUpdateRequestedById(component, id);
setParameterStatusMsg(tr("Requested retransmission of #%1").arg(id+1)); setParameterStatusMsg(tr("Requested retransmission of #%1").arg(id+1));
count++; count++;
} else { } else {
......
...@@ -27,12 +27,13 @@ protected: ...@@ -27,12 +27,13 @@ protected:
//TODO decouple this UI message display further //TODO decouple this UI message display further
virtual void setParameterStatusMsg(const QString& msg); virtual void setParameterStatusMsg(const QString& msg);
signals: signals:
void parameterChanged(int component, QString parameter, QVariant value); void parameterChanged(int component, QString parameter, QVariant value);
void parameterChanged(int component, int parameterIndex, QVariant value); void parameterChanged(int component, int parameterIndex, QVariant value);
void parameterListUpToDate(int component); void parameterListUpToDate(int component);
/** @brief Request a single parameter */ void parameterUpdateRequested(int component, const QString& parameter);
void requestParameter(int component, int parameter); void parameterUpdateRequestedById(int componentId, int paramId);
public slots: public slots:
...@@ -43,8 +44,7 @@ public slots: ...@@ -43,8 +44,7 @@ public slots:
/** @brief Check for missing parameters */ /** @brief Check for missing parameters */
virtual void retransmissionGuardTick(); virtual void retransmissionGuardTick();
/** @brief Request a single parameter by name */
/** @brief Request one single parameter */
virtual void requestParameterUpdate(int component, const QString& parameter); virtual void requestParameterUpdate(int component, const QString& parameter);
protected: protected:
......
...@@ -280,6 +280,7 @@ void UASManager::addUAS(UASInterface* uas) ...@@ -280,6 +280,7 @@ void UASManager::addUAS(UASInterface* uas)
// Only execute if there is no UAS at this index // Only execute if there is no UAS at this index
if (!systems.contains(uas)) if (!systems.contains(uas))
{ {
qDebug() << "Add new UAS: " << uas->getUASID();
systems.append(uas); systems.append(uas);
// Set home position on UAV if set in UI // Set home position on UAV if set in UI
// - this is done on a per-UAV basis // - this is done on a per-UAV basis
......
...@@ -91,8 +91,9 @@ void ParameterInterface::selectUAS(int index) ...@@ -91,8 +91,9 @@ void ParameterInterface::selectUAS(int index)
void ParameterInterface::addUAS(UASInterface* uas) void ParameterInterface::addUAS(UASInterface* uas)
{ {
int uasId = uas->getUASID(); int uasId = uas->getUASID();
qDebug() << "ParameterInterface::addUAS : " << uasId ;
if (paramWidgets->contains(uasId) ) { if (paramWidgets->contains(uasId) ) {
qDebug() << "Already have QGCParamWidget for: " << uasId ;
return; return;
} }
......
...@@ -144,11 +144,15 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : ...@@ -144,11 +144,15 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) :
// New parameters from UAS // New parameters from UAS
connect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(receivedParameterUpdate(int,int,int,int,QString,QVariant))); connect(uas, SIGNAL(parameterChanged(int,int,int,int,QString,QVariant)), this, SLOT(receivedParameterUpdate(int,int,int,int,QString,QVariant)));
// Connect retransmission guard
connect(this, SIGNAL(requestParameterByName(int,QString)), uas, SLOT(requestParameterByName(int,QString)));
connect(this, SIGNAL(requestParameterByName(int,int)), uas, SLOT(requestParameterByName(int,int)));
connect(&retransmissionTimer, SIGNAL(timeout()), this, SLOT(retransmissionGuardTick())); connect(&retransmissionTimer, SIGNAL(timeout()), this, SLOT(retransmissionGuardTick()));
// connect(this, SIGNAL(requestParameter(int,QString)), uas, SLOT(requestParameter(int,QString)));
// connect(this, SIGNAL(requestParameter(int,int)), uas, SLOT(requestParameter(int,int)));
// Get parameters // Get parameters
if (uas) { if (uas) {
requestAllParamsUpdate(); requestAllParamsUpdate();
......
...@@ -59,6 +59,7 @@ signals: ...@@ -59,6 +59,7 @@ signals:
/** @brief A parameter was changed in the widget, NOT onboard */ /** @brief A parameter was changed in the widget, NOT onboard */
//void parameterChanged(int component, QString parametername, float value); // defined in QGCUASParamManager already //void parameterChanged(int component, QString parametername, float value); // defined in QGCUASParamManager already
public slots: public slots:
/** @brief Add a component to the list */ /** @brief Add a component to the list */
void addComponentItem(int uas, int component, QString componentName); void addComponentItem(int uas, int component, QString componentName);
...@@ -69,7 +70,7 @@ public slots: ...@@ -69,7 +70,7 @@ public slots:
/** @brief Request list of parameters from MAV */ /** @brief Request list of parameters from MAV */
void requestAllParamsUpdate(); void requestAllParamsUpdate();
/** @brief Set one parameter, changes value in RAM of MAV */ /** @brief Set one parameter, changes value in RAM of MAV */
void setParameter(int component, QString parameterName, QVariant value); virtual void setParameter(int component, QString parameterName, QVariant value);
/** @brief Set all parameters, changes the value in RAM of MAV */ /** @brief Set all parameters, changes the value in RAM of MAV */
void setParameters(); void setParameters();
/** @brief Write the current parameters to permanent storage (EEPROM/HDD) */ /** @brief Write the current parameters to permanent storage (EEPROM/HDD) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment