From 05536245656437ff4b20117c379c178bae01f98e Mon Sep 17 00:00:00 2001 From: pixhawk Date: Sat, 24 Apr 2010 14:18:31 +0200 Subject: [PATCH] Improved XML generation, now has 64bit support --- src/comm/MAVLinkXMLParser.cc | 6 +++--- src/ui/linechart/LinechartPlot.cc | 13 +++++++++++-- src/ui/linechart/LinechartPlot.h | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/comm/MAVLinkXMLParser.cc b/src/comm/MAVLinkXMLParser.cc index 8a5b213d4..74b7c4fbf 100644 --- a/src/comm/MAVLinkXMLParser.cc +++ b/src/comm/MAVLinkXMLParser.cc @@ -161,7 +161,7 @@ bool MAVLinkXMLParser::generate() } else if (fieldType == "uint16_t" || fieldType == "int16_t") { - unpackingCode = QString("\tgeneric_32bit r;\n\tr.b[3] = (msg->payload%1)[0];\n\tr.b[1] = (msg->payload%1)[1];\n\treturn (%2)r.s;").arg(prepends).arg(fieldType); + unpackingCode = QString("\tgeneric_16bit r;\n\tr.b[1] = (msg->payload%1)[0];\n\tr.b[0] = (msg->payload%1)[1];\n\treturn (%2)r.s;").arg(prepends).arg(fieldType); } else if (fieldType == "uint32_t" || fieldType == "int32_t") { @@ -171,9 +171,9 @@ bool MAVLinkXMLParser::generate() { unpackingCode = QString("\tgeneric_32bit r;\n\tr.b[3] = (msg->payload%1)[0];\n\tr.b[2] = (msg->payload%1)[1];\n\tr.b[1] = (msg->payload%1)[2];\n\tr.b[0] = (msg->payload%1)[3];\n\treturn (%2)r.f;").arg(prepends).arg(fieldType); } - else if (fieldType == "uint32_t" || fieldType == "int32_t") + else if (fieldType == "uint64_t" || fieldType == "int64_t") { - unpackingCode = QString("\tgeneric_32bit r;\n\tr.b[3] = (msg->payload%1)[0];\n\tr.b[2] = (msg->payload%1)[1];\n\tr.b[1] = (msg->payload%1)[2];\n\tr.b[0] = (msg->payload%1)[3];\n\treturn (%2)r.f;").arg(prepends).arg(fieldType); + unpackingCode = QString("\tgeneric_64bit r;\n\tr.b[7] = (msg->payload%1)[0];\n\tr.b[6] = (msg->payload%1)[1];\n\tr.b[5] = (msg->payload%1)[2];\n\tr.b[4] = (msg->payload%1)[3];\n\tr.b[3] = (msg->payload%1)[4];\n\tr.b[2] = (msg->payload%1)[5];\n\tr.b[1] = (msg->payload%1)[6];\n\tr.b[0] = (msg->payload%1)[7];\n\treturn (%2)r.ll;").arg(prepends).arg(fieldType); } else if (fieldType.startsWith("array")) { // fieldtype formatis string[n] where n is the number of bytes, extract n from field type string diff --git a/src/ui/linechart/LinechartPlot.cc b/src/ui/linechart/LinechartPlot.cc index aa9b7c37b..c616e3e41 100644 --- a/src/ui/linechart/LinechartPlot.cc +++ b/src/ui/linechart/LinechartPlot.cc @@ -56,7 +56,8 @@ maxInterval(MAX_STORAGE_INTERVAL), timeScaleStep(DEFAULT_SCALE_INTERVAL), // 10 seconds automaticScrollActive(false), d_data(NULL), -d_curve(NULL) +d_curve(NULL), +m_active(true) { this->plotid = plotid; this->plotInterval = interval; @@ -188,6 +189,11 @@ void LinechartPlot::setRefreshRate(int ms) updateTimer->setInterval(ms); } +//void LinechartPlot::setActive(bool active) +//{ + +//} + /** * @brief Set the zero (center line) value * The zero value defines the centerline of the plot. @@ -585,7 +591,10 @@ void LinechartPlot::paintRealtime() canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, directPaint); #endif - replot(); + if (m_active) + { + replot(); + } #ifndef _WIN32 canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, oldDirectPaint); diff --git a/src/ui/linechart/LinechartPlot.h b/src/ui/linechart/LinechartPlot.h index c5975f9aa..50a8aa32c 100644 --- a/src/ui/linechart/LinechartPlot.h +++ b/src/ui/linechart/LinechartPlot.h @@ -281,6 +281,7 @@ protected: bool automaticScrollActive; QTime lastMaxTimeAdded; int plotid; + bool m_active; ///< Decides wether the plot is active or not // Methods void addCurve(QString id); -- 2.22.0