Commit 2a42532f authored by TobiasSimon's avatar TobiasSimon

symptom: heartbeat Hz value was always 0

cause: check for null pointer had no effect (static memory)
solution: fill mavlink messages (and thus) message type with 0xff. this patch assumes that message ID 0xff is never used
positiv side effect: qgroundcontrol uses 2% less cpu on my machine (eeepc)
parent aaf236a9
...@@ -24,7 +24,7 @@ QGCMAVLinkInspector::QGCMAVLinkInspector(MAVLinkProtocol* protocol, QWidget *par ...@@ -24,7 +24,7 @@ QGCMAVLinkInspector::QGCMAVLinkInspector(MAVLinkProtocol* protocol, QWidget *par
mavlink_message_info_t msg[256] = MAVLINK_MESSAGE_INFO; mavlink_message_info_t msg[256] = MAVLINK_MESSAGE_INFO;
memcpy(messageInfo, msg, sizeof(mavlink_message_info_t)*256); memcpy(messageInfo, msg, sizeof(mavlink_message_info_t)*256);
memset(receivedMessages, 0, sizeof(mavlink_message_t)*256); memset(receivedMessages, 0xFF, sizeof(mavlink_message_t)*256);
connect(protocol, SIGNAL(messageReceived(LinkInterface*,mavlink_message_t)), this, SLOT(receiveMessage(LinkInterface*,mavlink_message_t))); connect(protocol, SIGNAL(messageReceived(LinkInterface*,mavlink_message_t)), this, SLOT(receiveMessage(LinkInterface*,mavlink_message_t)));
QStringList header; QStringList header;
...@@ -95,7 +95,7 @@ void QGCMAVLinkInspector::refreshView() ...@@ -95,7 +95,7 @@ void QGCMAVLinkInspector::refreshView()
{ {
mavlink_message_t* msg = receivedMessages+i; mavlink_message_t* msg = receivedMessages+i;
// Ignore NULL values // Ignore NULL values
if (!msg) continue; if (msg->msgid == 0xFF) continue;
// Update the tree view // Update the tree view
QString messageName("%1 (%2 Hz, #%3)"); QString messageName("%1 (%2 Hz, #%3)");
float msgHz = (1.0f-updateHzLowpass)*messagesHz.value(msg->msgid, 0) + updateHzLowpass*((float)messageCount.value(msg->msgid, 0))/((float)updateInterval/1000.0f); float msgHz = (1.0f-updateHzLowpass)*messagesHz.value(msg->msgid, 0) + updateHzLowpass*((float)messageCount.value(msg->msgid, 0))/((float)updateInterval/1000.0f);
......
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