1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-505 Use clear() for OpenLRS settings reset

This commit is contained in:
Laurent Lalanne 2017-05-10 15:13:32 +02:00
parent ba5e5695db
commit 289285cadb
2 changed files with 9 additions and 8 deletions

View File

@ -608,13 +608,13 @@ void ConfigOPLinkWidget::unbind()
// Clear the OpenLRS settings when needed // Clear the OpenLRS settings when needed
if (isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPENLRS)) { if (isComboboxOptionSelected(m_oplink->Protocol, OPLinkSettings::PROTOCOL_OPENLRS)) {
oplinkSettingsObj->setVersion((quint16)0); QStringList openLRS_settings;
oplinkSettingsObj->setSerialBaudrate(0); openLRS_settings << "Version" << "SerialBaudrate" << "ModemParams" << "Flags" \
oplinkSettingsObj->setRFFrequency(0); << "RFFrequency" << "RFPower" << "RFChannelSpacing" << "HopChannel";
oplinkSettingsObj->setRFPower((quint16)0);
oplinkSettingsObj->setRFChannelSpacing((quint16)0); for (int i = 0; i < openLRS_settings.size(); ++i) {
oplinkSettingsObj->setModemParams((quint16)0); oplinkSettingsObj->getField(openLRS_settings[i])->clear();
oplinkSettingsObj->setFlags((quint16)0); }
} }
} }

View File

@ -80,6 +80,8 @@ public:
bool isText(); bool isText();
QString toString(); QString toString();
void clear();
void toXML(QXmlStreamWriter *xmlWriter); void toXML(QXmlStreamWriter *xmlWriter);
void fromXML(QXmlStreamReader *xmlReader); void fromXML(QXmlStreamReader *xmlReader);
@ -106,7 +108,6 @@ protected:
quint8 *data; quint8 *data;
UAVObject *obj; UAVObject *obj;
QMap<quint32, QList<LimitStruct> > elementLimits; QMap<quint32, QList<LimitStruct> > elementLimits;
void clear();
void constructorInitialize(const QString & name, const QString & description, 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); void limitsInitialize(const QString &limits);
}; };