Commit 0be24ebc authored by tstellanova's avatar tstellanova

rename parameters

parent 13279555
...@@ -16,23 +16,23 @@ public: ...@@ -16,23 +16,23 @@ public:
QGCUASParamManager(UASInterface* uas, QWidget *parent = 0); QGCUASParamManager(UASInterface* uas, QWidget *parent = 0);
QList<QString> getParameterNames(int component) const { QList<QString> getParameterNames(int component) const {
return parameters.value(component)->keys(); return onboardParameters.value(component)->keys();
} }
QList<QVariant> getParameterValues(int component) const { QList<QVariant> getParameterValues(int component) const {
return parameters.value(component)->values(); return onboardParameters.value(component)->values();
} }
bool getParameterValue(int component, const QString& parameter, QVariant& value) const { bool getParameterValue(int component, const QString& parameter, QVariant& value) const {
if (!parameters.contains(component)) if (!onboardParameters.contains(component))
{ {
return false; return false;
} }
if (!parameters.value(component)->contains(parameter)) if (!onboardParameters.value(component)->contains(parameter))
{ {
return false; return false;
} }
value = parameters.value(component)->value(parameter); value = onboardParameters.value(component)->value(parameter);
return true; return true;
} }
...@@ -64,10 +64,9 @@ public slots: ...@@ -64,10 +64,9 @@ public slots:
protected: protected:
//Parameter data model // Parameter data model
UASInterface* mav; ///< The MAV this widget is controlling UASInterface* mav; ///< The MAV this widget is controlling
// QMap<int, QMap<QString, QVariant>* > changedValues; ///< Changed values QMap<int, QMap<QString, QVariant>* > onboardParameters; ///< All parameters
QMap<int, QMap<QString, QVariant>* > parameters; ///< All parameters
UASParameterDataModel* paramDataModel;///< Shared data model of parameters UASParameterDataModel* paramDataModel;///< Shared data model of parameters
// Communications management // Communications management
......
...@@ -332,8 +332,8 @@ void QGCParamWidget::addComponent(int uas, int component, QString componentName) ...@@ -332,8 +332,8 @@ void QGCParamWidget::addComponent(int uas, int component, QString componentName)
tree->addTopLevelItem(comp); tree->addTopLevelItem(comp);
tree->update(); tree->update();
// Create map in parameters // Create map in parameters
if (!parameters.contains(component)) { if (!onboardParameters.contains(component)) {
parameters.insert(component, new QMap<QString, QVariant>()); onboardParameters.insert(component, new QMap<QString, QVariant>());
} }
// // Create map in changed parameters // // Create map in changed parameters
// if (!changedValues.contains(component)) { // if (!changedValues.contains(component)) {
...@@ -524,8 +524,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par ...@@ -524,8 +524,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par
// Replace value in map // Replace value in map
// FIXME // FIXME
if (parameters.value(component)->contains(parameterName)) parameters.value(component)->remove(parameterName); if (onboardParameters.value(component)->contains(parameterName)) onboardParameters.value(component)->remove(parameterName);
parameters.value(component)->insert(parameterName, value); onboardParameters.value(component)->insert(parameterName, value);
QString splitToken = "_"; QString splitToken = "_";
...@@ -666,7 +666,7 @@ void QGCParamWidget::requestParameterList() ...@@ -666,7 +666,7 @@ void QGCParamWidget::requestParameterList()
// Clear view and request param list // Clear view and request param list
clear(); clear();
parameters.clear(); onboardParameters.clear();
received.clear(); received.clear();
// Clear transmission state // Clear transmission state
transmissionListMode = true; transmissionListMode = true;
...@@ -715,35 +715,35 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column) ...@@ -715,35 +715,35 @@ void QGCParamWidget::parameterItemChanged(QTreeWidgetItem* current, int column)
map->insert(str, value); map->insert(str, value);
// Check if the value was numerically changed // Check if the value was numerically changed
if (!parameters.value(key)->contains(str) || parameters.value(key)->value(str, value.toDouble()-1) != value) { if (!onboardParameters.value(key)->contains(str) || onboardParameters.value(key)->value(str, value.toDouble()-1) != value) {
current->setBackground(0, QBrush(QColor(QGC::colorOrange))); current->setBackground(0, QBrush(QColor(QGC::colorOrange)));
current->setBackground(1, QBrush(QColor(QGC::colorOrange))); current->setBackground(1, QBrush(QColor(QGC::colorOrange)));
} }
switch ((int)parameters.value(key)->value(str).type()) switch ((int)onboardParameters.value(key)->value(str).type())
{ {
case QVariant::Int: case QVariant::Int:
{ {
QVariant fixedValue(value.toInt()); QVariant fixedValue(value.toInt());
parameters.value(key)->insert(str, fixedValue); onboardParameters.value(key)->insert(str, fixedValue);
} }
break; break;
case QVariant::UInt: case QVariant::UInt:
{ {
QVariant fixedValue(value.toUInt()); QVariant fixedValue(value.toUInt());
parameters.value(key)->insert(str, fixedValue); onboardParameters.value(key)->insert(str, fixedValue);
} }
break; break;
case QMetaType::Float: case QMetaType::Float:
{ {
QVariant fixedValue(value.toFloat()); QVariant fixedValue(value.toFloat());
parameters.value(key)->insert(str, fixedValue); onboardParameters.value(key)->insert(str, fixedValue);
} }
break; break;
case QMetaType::QChar: case QMetaType::QChar:
{ {
QVariant fixedValue(QChar((unsigned char)value.toUInt())); QVariant fixedValue(QChar((unsigned char)value.toUInt()));
parameters.value(key)->insert(str, fixedValue); onboardParameters.value(key)->insert(str, fixedValue);
} }
break; break;
default: default:
...@@ -771,7 +771,7 @@ void QGCParamWidget::saveParametersToFile() ...@@ -771,7 +771,7 @@ void QGCParamWidget::saveParametersToFile()
// Iterate through all components, through all parameters and emit them // Iterate through all components, through all parameters and emit them
QMap<int, QMap<QString, QVariant>*>::iterator i; QMap<int, QMap<QString, QVariant>*>::iterator i;
for (i = parameters.begin(); i != parameters.end(); ++i) { for (i = onboardParameters.begin(); i != onboardParameters.end(); ++i) {
// Iterate through the parameters of the component // Iterate through the parameters of the component
int compid = i.key(); int compid = i.key();
QMap<QString, QVariant>* comp = i.value(); QMap<QString, QVariant>* comp = i.value();
...@@ -874,8 +874,8 @@ void QGCParamWidget::loadParametersFromFile() ...@@ -874,8 +874,8 @@ void QGCParamWidget::loadParametersFromFile()
bool changed = false; bool changed = false;
int componentId = wpParams.at(1).toInt(); int componentId = wpParams.at(1).toInt();
QString parameterName = wpParams.at(2); QString parameterName = wpParams.at(2);
if (!parameters.contains(componentId) || if (!onboardParameters.contains(componentId) ||
fabs((static_cast<float>(parameters.value(componentId)->value(parameterName, wpParams.at(3).toDouble()).toDouble())) - (wpParams.at(3).toDouble())) > 2.0f * FLT_EPSILON) { fabs((static_cast<float>(onboardParameters.value(componentId)->value(parameterName, wpParams.at(3).toDouble()).toDouble())) - (wpParams.at(3).toDouble())) > 2.0f * FLT_EPSILON) {
changed = true; changed = true;
qDebug() << "Changed" << parameterName << "VAL" << wpParams.at(3).toDouble(); qDebug() << "Changed" << parameterName << "VAL" << wpParams.at(3).toDouble();
} }
...@@ -940,7 +940,7 @@ void QGCParamWidget::retransmissionGuardTick() ...@@ -940,7 +940,7 @@ void QGCParamWidget::retransmissionGuardTick()
// Re-request at maximum retransmissionBurstRequestSize parameters at once // Re-request at maximum retransmissionBurstRequestSize parameters at once
// to prevent link flooding // to prevent link flooding
QMap<int, QMap<QString, QVariant>*>::iterator i; QMap<int, QMap<QString, QVariant>*>::iterator i;
for (i = parameters.begin(); i != parameters.end(); ++i) { for (i = onboardParameters.begin(); i != onboardParameters.end(); ++i) {
// Iterate through the parameters of the component // Iterate through the parameters of the component
int component = i.key(); int component = i.key();
// Request n parameters from this component (at maximum) // Request n parameters from this component (at maximum)
...@@ -971,7 +971,7 @@ void QGCParamWidget::retransmissionGuardTick() ...@@ -971,7 +971,7 @@ void QGCParamWidget::retransmissionGuardTick()
if (count < retransmissionBurstRequestSize) { if (count < retransmissionBurstRequestSize) {
// Re-request write operation // Re-request write operation
QVariant value = missingParams->value(key); QVariant value = missingParams->value(key);
switch ((int)parameters.value(component)->value(key).type()) switch ((int)onboardParameters.value(component)->value(key).type())
{ {
case QVariant::Int: case QVariant::Int:
{ {
...@@ -1035,13 +1035,13 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant ...@@ -1035,13 +1035,13 @@ void QGCParamWidget::setParameter(int component, QString parameterName, QVariant
statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble())); statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble()));
return; return;
} }
if (parameters.value(component)->value(parameterName) == value) if (onboardParameters.value(component)->value(parameterName) == value)
{ {
statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble())); statusLabel->setText(tr("REJ. %1 > max").arg(value.toDouble()));
return; return;
} }
switch ((int)parameters.value(component)->value(parameterName).type()) switch ((int)onboardParameters.value(component)->value(parameterName).type())
{ {
case QVariant::Char: case QVariant::Char:
{ {
......
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