chore(cpn): read/write semver in model and radio yml files (#1977)

Companion part of #1695, making it so companion is not removing written semver
This commit is contained in:
Neil Horne
2022-06-04 11:09:39 +10:00
committed by GitHub
parent d70828579e
commit 077abf719d
4 changed files with 13 additions and 4 deletions
@@ -27,6 +27,7 @@
#include "eeprominterface.h"
#include "edgetxinterface.h"
#include "version.h"
#include <QMessageBox>
@@ -143,11 +144,11 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
{
Node node;
node["semver"] = VERSION;
std::string board = getCurrentFirmware()->getFlavour().toStdString();
node["board"] = board;
node["version"] = CPN_CURRENT_SETTINGS_VERSION;
YamlCalibData calib(rhs.calibMid, rhs.calibSpanNeg, rhs.calibSpanPos);
node["calib"] = calib;
@@ -282,7 +283,8 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
// qDebug() << QString::fromStdString(n.first.Scalar());
// }
node["version"] >> rhs.version;
node["semver"] >> rhs.semver;
rhs.version = CPN_CURRENT_SETTINGS_VERSION; // depreciated in EdgeTX however data conversions use
// Decoding uses profile firmare therefore all conversions are performed on the fly
// So set board to firmware board
@@ -303,7 +305,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
auto fw = getCurrentFirmware();
qDebug() << "Settings version:" << rhs.version << "File flavour:" << flavour.c_str() << "Firmware flavour:" << fw->getFlavour();
qDebug() << "Settings version:" << rhs.semver << "File flavour:" << flavour.c_str() << "Firmware flavour:" << fw->getFlavour();
if (flavour.empty()) {
QString prmpt = QCoreApplication::translate("YamlGeneralSettings", "Warning: Radio settings file is missing the board entry!\n\nCurrent firmware profile board will be used.\n\nDo you wish to continue?");