Commit 432a42d4 authored by Don Gagne's avatar Don Gagne

Fix param crash and connect/disconnect

parent c8441884
......@@ -100,23 +100,24 @@ void MockLink::readBytes(void)
bool MockLink::_connect(void)
{
if (!_connected) {
_connected = true;
start();
emit connected();
emit connected(true);
}
return true;
}
bool MockLink::_disconnect(void)
{
if (_connected) {
_connected = false;
exit();
emit disconnected();
emit connected(false);
}
return true;
}
......@@ -136,9 +137,6 @@ void MockLink::run(void)
_timer50HzTasks.start(20);
exec();
emit disconnected();
emit connected(false);
}
void MockLink::_run1HzTasks(void)
......@@ -382,11 +380,13 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
for (param = _parameters.begin(); param != _parameters.end(); param++) {
mavlink_message_t responseMsg;
char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN];
strncpy(paramId, param.key().toLocal8Bit().constData(), MAVLINK_MSG_ID_PARAM_VALUE_LEN);
mavlink_msg_param_value_pack(_vehicleSystemId,
_vehicleComponentId,
&responseMsg, // Outgoing message
param.key().toLocal8Bit().constData(), // Parameter name
paramId, // Parameter name
param.value().toFloat(), // Parameter vluae
MAV_PARAM_TYPE_REAL32, // FIXME: Pull from QVariant type
_cParameters, // Total number of parameters
......
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