diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h index 793291c60..238f7431c 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h @@ -471,7 +471,6 @@ private: { return QVariant(str.toString().at(0).toLatin1()); } - }; #endif // FIELDTREEITEM_H diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.cpp index d4e5fb968..71b9cf690 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.cpp @@ -250,7 +250,7 @@ QVariant ArrayFieldTreeItem::data(int column) const .arg(m_field->getValue(i).toUInt(&ok), TreeItem::maxHexStringLength(m_field->getType()), 16, QChar('0')).toUpper()); } - QString data = QString("{%1}").arg(dataString); + QString data = QString("{%1}").arg(dataString); return data; } else { return QVariant(); diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h index 08e4b2038..9d6ab8e02 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h @@ -184,16 +184,22 @@ public: switch (type) { case UAVObjectField::INT8: return 2; + case UAVObjectField::INT16: return 4; + case UAVObjectField::INT32: return 8; + case UAVObjectField::UINT8: return 2; + case UAVObjectField::UINT16: return 4; + case UAVObjectField::UINT32: return 8; + default: Q_ASSERT(false); } @@ -352,7 +358,7 @@ public: QVariant data(int column) const; private: - UAVObjectField*m_field; + UAVObjectField *m_field; }; #endif // TREEITEM_H diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp index ca57295a8..bd456d145 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp @@ -245,6 +245,7 @@ void UAVObjectTreeModel::addSingleField(int index, UAVObjectField *field, TreeIt Q_ASSERT(false); } item->setHighlightManager(m_highlightManager); + item->setDescription(field->getDescription()); connect(item, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *))); parent->appendChild(item); } diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp index 5c7d2755d..985eaffe2 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp @@ -41,10 +41,10 @@ UAVMetaObject::UAVMetaObject(quint32 objID, const QString & name, UAVObject *par QStringList modesBitField; modesBitField << tr("FlightReadOnly") << tr("GCSReadOnly") << tr("FlightTelemetryAcked") << tr("GCSTelemetryAcked") << tr("FlightUpdatePeriodic") << tr("FlightUpdateOnChange") << tr("GCSUpdatePeriodic") << tr("GCSUpdateOnChange") << tr("LoggingUpdatePeriodic") << tr("LoggingUpdateOnChange"); QList fields; - fields.append(new UAVObjectField(tr("Modes"), tr("boolean"), UAVObjectField::BITFIELD, modesBitField, QStringList())); - fields.append(new UAVObjectField(tr("Flight Telemetry Update Period"), tr("ms"), UAVObjectField::UINT16, 1, QStringList())); - fields.append(new UAVObjectField(tr("GCS Telemetry Update Period"), tr("ms"), UAVObjectField::UINT16, 1, QStringList())); - fields.append(new UAVObjectField(tr("Logging Update Period"), tr("ms"), UAVObjectField::UINT16, 1, QStringList())); + fields.append(new UAVObjectField(tr("Modes"), tr("Metadata modes"), tr("boolean"), UAVObjectField::BITFIELD, modesBitField, QStringList())); + fields.append(new UAVObjectField(tr("Flight Telemetry Update Period"), tr("This is how often flight side will update telemetry data"), tr("ms"), UAVObjectField::UINT16, 1, QStringList())); + fields.append(new UAVObjectField(tr("GCS Telemetry Update Period"), tr("This is how often GCS will update telemetry data"), tr("ms"), UAVObjectField::UINT16, 1, QStringList())); + fields.append(new UAVObjectField(tr("Logging Update Period"), tr("This is how often logging will be updated."), tr("ms"), UAVObjectField::UINT16, 1, QStringList())); // Initialize parent UAVObject::initialize(0); UAVObject::initializeFields(fields, (quint8 *)&parentMetadata, sizeof(Metadata)); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index 76ab6296c..9b22bb083 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -30,7 +30,7 @@ #include #include -UAVObjectField::UAVObjectField(const QString & name, const QString & units, FieldType type, quint32 numElements, const QStringList & options, const QString &limits) +UAVObjectField::UAVObjectField(const QString & name, const QString & description, const QString & units, FieldType type, quint32 numElements, const QStringList & options, const QString &limits) { QStringList elementNames; @@ -39,18 +39,19 @@ UAVObjectField::UAVObjectField(const QString & name, const QString & units, Fiel elementNames.append(QString("%1").arg(n)); } // Initialize - constructorInitialize(name, units, type, elementNames, options, limits); + constructorInitialize(name, description, units, type, elementNames, options, limits); } -UAVObjectField::UAVObjectField(const QString & name, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits) +UAVObjectField::UAVObjectField(const QString & name, const QString & description, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits) { - constructorInitialize(name, units, type, elementNames, options, limits); + constructorInitialize(name, description, units, type, elementNames, options, limits); } -void UAVObjectField::constructorInitialize(const QString & name, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits) +void UAVObjectField::constructorInitialize(const QString & name, const QString & description, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits) { // Copy params this->name = name; + this->description = description; this->units = units; this->type = type; this->options = options; @@ -609,6 +610,11 @@ QString UAVObjectField::getName() return name; } +QString UAVObjectField::getDescription() +{ + return description; +} + QString UAVObjectField::getUnits() { return units; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h index 6142bc923..4c1945bb2 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h @@ -52,13 +52,14 @@ public: int board; } LimitStruct; - UAVObjectField(const QString & name, const QString & units, FieldType type, quint32 numElements, const QStringList & options, const QString & limits = QString()); - UAVObjectField(const QString & name, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString & limits = QString()); + UAVObjectField(const QString & name, const QString & description, const QString & units, FieldType type, quint32 numElements, const QStringList & options, const QString & limits = QString()); + UAVObjectField(const QString & name, const QString & description, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString & limits = QString()); void initialize(quint8 *data, quint32 dataOffset, UAVObject *obj); UAVObject *getObject(); FieldType getType(); QString getTypeAsString(); QString getName(); + QString getDescription(); QString getUnits(); quint32 getNumElements(); QStringList getElementNames(); @@ -91,6 +92,7 @@ signals: protected: QString name; + QString description; QString units; FieldType type; QStringList elementNames; @@ -102,7 +104,7 @@ protected: UAVObject *obj; QMap > elementLimits; void clear(); - void constructorInitialize(const QString & name, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits); + void constructorInitialize(const QString & name, const QString & description, const QString & units, FieldType type, const QStringList & elementNames, const QStringList & options, const QString &limits); void limitsInitialize(const QString &limits); }; diff --git a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp index 7265d411a..1279e8e4f 100644 --- a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp +++ b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp @@ -259,8 +259,9 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info) .arg(varOptionName) .arg(options[m])); } - finit.append(QString(" fields.append( new UAVObjectField(QString(\"%1\"), QString(\"%2\"), UAVObjectField::ENUM, %3, %4, QString(\"%5\")));\n") + finit.append(QString(" fields.append( new UAVObjectField(QString(\"%1\"), tr(\"%2\"), QString(\"%3\"), UAVObjectField::ENUM, %4, %5, QString(\"%6\")));\n") .arg(info->fields[n]->name) + .arg(info->fields[n]->description) .arg(info->fields[n]->units) .arg(varElemName) .arg(varOptionName) @@ -268,8 +269,9 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info) } // For all other types else { - finit.append(QString(" fields.append( new UAVObjectField(QString(\"%1\"), QString(\"%2\"), UAVObjectField::%3, %4, QStringList(), QString(\"%5\")));\n") + finit.append(QString(" fields.append( new UAVObjectField(QString(\"%1\"), tr(\"%2\"), QString(\"%3\"), UAVObjectField::%4, %5, QStringList(), QString(\"%6\")));\n") .arg(info->fields[n]->name) + .arg(info->fields[n]->description) .arg(info->fields[n]->units) .arg(fieldTypeStrCPPClass[info->fields[n]->type]) .arg(varElemName) diff --git a/ground/uavobjgenerator/uavobjectparser.cpp b/ground/uavobjgenerator/uavobjectparser.cpp index a8534088c..6ef2496a6 100644 --- a/ground/uavobjgenerator/uavobjectparser.cpp +++ b/ground/uavobjgenerator/uavobjectparser.cpp @@ -25,7 +25,7 @@ */ #include "uavobjectparser.h" - +#include /** * Constructor */ @@ -441,6 +441,21 @@ QString UAVObjectParser::processObjectFields(QDomNode & childNode, ObjectInfo *i field->name = name; } + // Get description attribute if any + elemAttr = elemAttributes.namedItem("description"); + if (!elemAttr.isNull()) { + field->description = elemAttr.nodeValue(); + } else { + // Look for a child description node + QDomNode node = childNode.firstChildElement("description"); + if (!node.isNull()) { + QDomNode description = node.firstChild(); + if (!description.isNull()) { + field->description = description.nodeValue(); + } + } + } + // Get units attribute elemAttr = elemAttributes.namedItem("units"); if (elemAttr.isNull()) { @@ -572,6 +587,7 @@ QString UAVObjectParser::processObjectFields(QDomNode & childNode, ObjectInfo *i } // Add field to object info->fields.append(field); + qDebug() << "field added" << info->name << ", description" << field->description; // Done return QString(); } diff --git a/ground/uavobjgenerator/uavobjectparser.h b/ground/uavobjgenerator/uavobjectparser.h index 9028af325..ccc537cdf 100644 --- a/ground/uavobjgenerator/uavobjectparser.h +++ b/ground/uavobjgenerator/uavobjectparser.h @@ -49,6 +49,7 @@ typedef enum { typedef struct { QString name; + QString description; QString units; FieldType type; int numElements; diff --git a/shared/uavobjectdefinition/debuglogsettings.xml b/shared/uavobjectdefinition/debuglogsettings.xml index cb5fef6ed..2a97b04cb 100644 --- a/shared/uavobjectdefinition/debuglogsettings.xml +++ b/shared/uavobjectdefinition/debuglogsettings.xml @@ -1,7 +1,10 @@ Configure On Board Logging Facilities - + + + If set to OnlyWhenArmed logs will only be saved when craft is armed. Disabled turns logging off, and Always will always log. + diff --git a/shared/uavobjectdefinition/debuglogstatus.xml b/shared/uavobjectdefinition/debuglogstatus.xml index 0d510a332..b1183d684 100644 --- a/shared/uavobjectdefinition/debuglogstatus.xml +++ b/shared/uavobjectdefinition/debuglogstatus.xml @@ -1,10 +1,10 @@ Log Status Object, contains log partition status information - - - - + + + +