feat: Support for 8s Cell Sensor such as FrSky FLVS ADV (#2302)

* first commit for FrSky 8s Lipo Sensor

FLVS Advanced transfers up to 8 cell voltages for Cels sensor

* correcting mistake made transferring local change to PR

* complementary extension of Companion telemetry simulator to enable simulation of  8 cells

* change to allow selection of cells 7 and 8 in calculated sensor with formula Cell

* (cpn) Add bin and yml conversions and basic semantic version helper

Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
Michael
2022-09-27 20:06:26 +10:00
committed by GitHub
co-authored by elecpower
parent 513578643c
commit 73861554ec
27 changed files with 255 additions and 22 deletions
@@ -34,6 +34,7 @@
#include "output_data.h"
#include "eeprominterface.h"
#include "version.h"
#include "helpers.h"
#include <string>
@@ -1140,6 +1141,19 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
node["functionSwitchStartConfig"] >> rhs.functionSwitchStartConfig;
node["functionSwitchLogicalState"] >> rhs.functionSwitchLogicalState;
node["switchNames"] >> rhs.functionSwitchNames;
// preferably perform conversions here to avoid cluttering the field decodes
if (SemanticVersion(QString(rhs.semver)) < SemanticVersion("2.8.0")) {
// Cells 7 and 8 introduced requiring Highest and Delta to be shifted + 2
for (int i = 0; i < CPN_MAX_SENSORS; i++) {
SensorData &sd = rhs.sensorData[i];
if (!sd.isEmpty() && sd.type == SensorData::TELEM_TYPE_CALCULATED &&
sd.formula == SensorData::TELEM_FORMULA_CELL && sd.index > 6)
sd.index += 2;
}
}
return true;
}