Commit a705367c authored by lm's avatar lm

Verified parameter interface, sends now only changed parameters back to MAV,...

Verified parameter interface, sends now only changed parameters back to MAV, auto-grouping supported
parent 8ffb58a7
...@@ -82,6 +82,7 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : ...@@ -82,6 +82,7 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) :
headerItems.append("Value"); headerItems.append("Value");
tree->setHeaderLabels(headerItems); tree->setHeaderLabels(headerItems);
tree->setColumnCount(2); tree->setColumnCount(2);
tree->setExpandsOnDoubleClick(true);
// Connect signals/slots // Connect signals/slots
connect(this, SIGNAL(parameterChanged(int,QString,float)), mav, SLOT(setParameter(int,QString,float))); connect(this, SIGNAL(parameterChanged(int,QString,float)), mav, SLOT(setParameter(int,QString,float)));
...@@ -222,9 +223,10 @@ void QGCParamWidget::addParameter(int uas, int component, QString parameterName, ...@@ -222,9 +223,10 @@ void QGCParamWidget::addParameter(int uas, int component, QString parameterName,
//tree->expandAll(); //tree->expandAll();
} }
// Reset background color // Reset background color
parameterItem->setBackground(0, QBrush(Qt::NoBrush)); parameterItem->setBackground(0, QBrush(QColor(0, 0, 0)));
parameterItem->setBackground(1, QBrush(Qt::NoBrush)); parameterItem->setBackground(1, Qt::NoBrush);
tree->update(); //tree->update();
if (changedValues.contains(component)) changedValues.value(component)->remove(parameterName);
} }
/** /**
...@@ -265,9 +267,10 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column) ...@@ -265,9 +267,10 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
if (ok) if (ok)
{ {
qDebug() << "PARAM CHANGED: COMP:" << key << "KEY:" << str << "VALUE:" << value; qDebug() << "PARAM CHANGED: COMP:" << key << "KEY:" << str << "VALUE:" << value;
if (map->contains(str)) map->remove(str);
map->insert(str, value); map->insert(str, value);
current->setBackground(0, QBrush(QColor(QGC::colorGreen))); //current->setBackground(0, QBrush(QColor(QGC::colorGreen)));
current->setBackground(1, QBrush(QColor(QGC::colorGreen))); //current->setBackground(1, QBrush(QColor(QGC::colorGreen)));
} }
} }
} }
...@@ -282,6 +285,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column) ...@@ -282,6 +285,7 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
void QGCParamWidget::setParameter(int component, QString parameterName, float value) void QGCParamWidget::setParameter(int component, QString parameterName, float value)
{ {
emit parameterChanged(component, parameterName, value); emit parameterChanged(component, parameterName, value);
qDebug() << "SENT PARAM" << parameterName << value;
} }
/** /**
...@@ -300,7 +304,7 @@ void QGCParamWidget::setParameters() ...@@ -300,7 +304,7 @@ void QGCParamWidget::setParameters()
QMap<QString, float>::iterator j; QMap<QString, float>::iterator j;
for (j = comp->begin(); j != comp->end(); ++j) for (j = comp->begin(); j != comp->end(); ++j)
{ {
emit parameterChanged(compid, j.key(), j.value()); setParameter(compid, j.key(), j.value());
} }
} }
} }
......
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