Commit 97568cf4 authored by Don Gagne's avatar Don Gagne

Merge pull request #1519 from DonLakeFlyer/ParamEdit

New parameter editor
parents 2f7fe9dd a6cabdf4
......@@ -87,14 +87,6 @@ void ParameterLoader::_parameterUpdate(int uasId, int componentId, QString param
"value:" << value <<
")";
#if 1
// This code is handy for testing re-request logic. It drops ever other param update.
static int increment = 0;
if (increment++ & 1) {
return;
}
#endif
_dataMutex.lock();
// Restart our waiting for param timer
......
This diff is collapsed.
......@@ -28,40 +28,6 @@ import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
Rectangle {
QGCPalette { id: qgcPal; colorGroupEnabled: true }
ScreenTools { id: screenTools }
color: qgcPal.window
// We use an ExclusiveGroup to maintain the visibility of a single editing control at a time
ExclusiveGroup {
id: exclusiveEditorGroup
}
Column {
anchors.fill:parent
QGCLabel {
text: "PARAMETER EDITOR"
font.pointSize: screenTools.fontPointFactor * (20)
}
Item {
height: 20
width: 5
}
QGCLabel {
id: infoLabel
width: parent.width
wrapMode: Text.WordWrap
text: "Click a parameter value to modify. Right-click for additional options. Values which have been modified from the default are shown in orange. Use caution when modifying parameters here since the values are not checked for validity."
}
ParameterEditor {
width: parent.width
height: parent.height - (infoLabel.y + infoLabel.height)
}
}
ParameterEditor {
fullMode: true
}
......@@ -464,6 +464,9 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
Q_ASSERT(request.target_system == _vehicleSystemId);
Q_ASSERT(request.target_component == MAV_COMP_ID_ALL);
// We must send the first parameter for each component first. Otherwise system won't correctly know
// when all parameters are loaded.
foreach (int componentId, _mapParamName2Value.keys()) {
uint16_t paramIndex = 0;
......@@ -492,6 +495,46 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
cParameters, // Total number of parameters
paramIndex++); // Index of this parameter
_emitMavlinkMessage(responseMsg);
// Only first parameter the first time through
break;
}
}
foreach (int componentId, _mapParamName2Value.keys()) {
uint16_t paramIndex = 0;
int cParameters = _mapParamName2Value[componentId].count();
bool skipParam = true;
foreach(QString paramName, _mapParamName2Value[componentId].keys()) {
if (skipParam) {
// We've already sent the first param
skipParam = true;
paramIndex++;
} else {
char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN];
mavlink_message_t responseMsg;
Q_ASSERT(_mapParamName2Value[componentId].contains(paramName));
Q_ASSERT(_mapParamName2MavParamType.contains(paramName));
MAV_PARAM_TYPE paramType = _mapParamName2MavParamType[paramName];
Q_ASSERT(paramName.length() <= MAVLINK_MSG_ID_PARAM_VALUE_LEN);
strncpy(paramId, paramName.toLocal8Bit().constData(), MAVLINK_MSG_ID_PARAM_VALUE_LEN);
qCDebug(MockLinkLog) << "Sending msg_param_value" << componentId << paramId << paramType << _mapParamName2Value[componentId][paramId];
mavlink_msg_param_value_pack(_vehicleSystemId,
componentId, // component id
&responseMsg, // Outgoing message
paramId, // Parameter name
_floatUnionForParam(componentId, paramName), // Parameter value
paramType, // MAV_PARAM_TYPE
cParameters, // Total number of parameters
paramIndex++); // Index of this parameter
_emitMavlinkMessage(responseMsg);
}
}
}
}
......
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