Commit d67a305f authored by Michael Carpenter's avatar Michael Carpenter

Code cleanup and additional error checking in QGCVehicleConfig.cc

parent 5b943e88
......@@ -881,6 +881,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (parameters.value(component)->contains(parameterName)) parameters.value(component)->remove(parameterName);
// Insert with correct type
// TODO: This is a hack for MAV_AUTOPILOT_ARDUPILOTMEGA until the new version of MAVLink and a fix for their param handling.
switch (value.param_type)
{
case MAV_PARAM_TYPE_REAL32:
......@@ -2334,6 +2335,7 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v
mavlink_param_union_t union_value;
// Assign correct value based on QVariant
// TODO: This is a hack for MAV_AUTOPILOT_ARDUPILOTMEGA until the new version of MAVLink and a fix for their param handling.
if (getAutopilotType() == MAV_AUTOPILOT_ARDUPILOTMEGA)
{
switch (value.type())
......
This diff is collapsed.
......@@ -31,7 +31,9 @@ public:
public slots:
/** Set the MAV currently being calibrated */
void setActiveUAS(UASInterface* active);
/** Fallback function, automatically called by loadConfig() upon failure to find and xml file*/
void loadQgcConfig();
/** Load configuration from xml file */
void loadConfig();
/** Start the RC calibration routine */
void startCalibrationRC();
......@@ -173,18 +175,17 @@ protected:
QList<QGCToolWidget*> toolWidgets; ///< Configurable widgets
bool calibrationEnabled; ///< calibration mode on / off
QMap<QString,QGCToolWidget*> *paramToWidgetMap;
QMap<QString,QGCToolWidget*> *libParamToWidgetMap;
QMap<QString,QMap<QString,QGCToolWidget*>*> systemTypeToParamMap;
QMap<QGCToolWidget*,QGroupBox*> toolToBoxMap;
QMap<QString,QString> paramTooltips;
QMap<QString,QGCToolWidget*> *paramToWidgetMap; ///< Holds the current active MAV's parameter widgets.
QMap<QString,QGCToolWidget*> *libParamToWidgetMap; ///< Holds the library parameter widgets
QMap<QString,QMap<QString,QGCToolWidget*>*> systemTypeToParamMap; ///< Holds all loaded MAV specific parameter widgets, for every MAV.
QMap<QGCToolWidget*,QGroupBox*> toolToBoxMap; ///< Easy method of figuring out which QGroupBox is tied to which ToolWidget.
QMap<QString,QString> paramTooltips; ///< Tooltips for the ? button next to a parameter.
private:
Ui::QGCVehicleConfig *ui;
signals:
void visibilityChanged(bool visible);
void configReady();
};
#endif // QGCVEHICLECONFIG_H
......@@ -946,7 +946,7 @@ p, li { white-space: pre-wrap; }
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="leftHWSpecificLayout"/>
<layout class="QVBoxLayout" name="leftAdvancedLayout"/>
</item>
</layout>
</widget>
......@@ -983,7 +983,7 @@ p, li { white-space: pre-wrap; }
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="rightHWSpecificLayout"/>
<layout class="QVBoxLayout" name="rightAdvancedLayout"/>
</item>
</layout>
</widget>
......
......@@ -200,18 +200,11 @@ QList<QString> QGCToolWidget::getParamList()
}
void QGCToolWidget::setParameterValue(int uas, int component, QString parameterName, const QVariant value)
{
//settings.setValue("QGC_PARAM_SLIDER_PARAMID", parameterName);
//settings.setValue("QGC_PARAM_COMBOBOX_PARAMID", parameterName);
QString widgetName = getTitle();
//settings.beginGroup(widgetName);
//qDebug() << "LOADING FOR" << widgetName;
//int size = settings.beginReadArray("QGC_TOOL_WIDGET_ITEMS");
int size = settingsMap["count"].toInt();
//qDebug() << "CHILDREN SIZE:" << size;
if (paramToItemMap.contains(parameterName))
{
//slider->setParameterValue(uas,component,0,-1,paramname,value);
//paramToItemMap[parameterName]->set
//If we already have an item for this parameter, updates are handled internally.
return;
}
......@@ -221,9 +214,8 @@ void QGCToolWidget::setParameterValue(int uas, int component, QString parameterN
QGCToolWidgetItem* item = NULL;
if (type == "COMMANDBUTTON")
{
return;
//item = new QGCCommandButton(this);
//qDebug() << "CREATED COMMANDBUTTON";
//This shouldn't happen, but I'm not sure... so lets test for it.
continue;
}
else if (type == "SLIDER")
{
......@@ -234,11 +226,8 @@ void QGCToolWidget::setParameterValue(int uas, int component, QString parameterN
paramToItemMap[parameterName] = item;
addToolWidget(item);
item->readSettings(widgetName + "\\" + QString::number(j) + "\\",settingsMap);
return;
}
//qDebug() << "CREATED PARAM SLIDER";
}
else if (type == "COMBO")
{
......@@ -251,8 +240,6 @@ void QGCToolWidget::setParameterValue(int uas, int component, QString parameterN
paramToItemMap[parameterName] = item;
return;
}
//qDebug() << "CREATED PARAM COMBOBOX";
}
}
}
......
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