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
@@ -33,6 +33,7 @@
#include "modeldata.h"
#include "output_data.h"
#include "eeprominterface.h"
#include "version.h"
#include <string>
@@ -741,6 +742,8 @@ Node convert<ModelData>::encode(const ModelData& rhs)
Node node;
auto board = getCurrentBoard();
node["semver"] = VERSION;
Node header;
header["name"] = rhs.name;
header["bitmap"] = rhs.bitmap;
@@ -980,6 +983,8 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
unsigned int modelIds[CPN_MAX_MODULES];
memset(modelIds, 0, sizeof(modelIds));
node["semver"] >> rhs.semver;
if (node["header"]) {
const auto& header = node["header"];
if (header.IsMap()) {