Skip to content

Commit

Permalink
cpn yaml remove redundant funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Jul 16, 2024
1 parent efbe27f commit a1e9613
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
42 changes: 0 additions & 42 deletions companion/src/firmwares/edgetx/yaml_mixdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,6 @@ static const YamlLookupTable mixMultiplexLut = {
#define GVAR_SMALL 128
#define CPN_GV1 1024

int32_t YamlReadMixWeight(const YAML::Node& node)
{
std::string val = node.as<std::string>();
if ((val.size() >= 4)
&& (val[0] == '-')
&& (val[1] == 'G')
&& (val[2] == 'V')
&& (val[3] >= '1')
&& (val[3] <= '9')) {

return -10000 - std::stoi(val.substr(3));
}

if ((val.size() >= 3)
&& (val[0] == 'G')
&& (val[1] == 'V')
&& (val[2] >= '1')
&& (val[2] <= '9')) {

return 10000 + std::stoi(val.substr(2));
}

try {
return std::stoi(val);
} catch(...) {
throw YAML::TypedBadConversion<int>(node.Mark());
}
}

std::string YamlWriteMixWeight(int32_t sval)
{
if (sval < -10000) {
int n = -sval - 10000;
return std::string("-GV") + std::to_string(n);
} else if (sval > 10000) {
int n = sval - 10000;
return std::string("GV") + std::to_string(n);
}

return std::to_string(sval);
}

int32_t YamlSourceNumRefDecode(const YAML::Node& node)
{
std::string val = node.as<std::string>();
Expand Down
3 changes: 0 additions & 3 deletions companion/src/firmwares/edgetx/yaml_mixdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include "yaml_ops.h"
#include "mixdata.h"

int32_t YamlReadMixWeight(const YAML::Node& node);
std::string YamlWriteMixWeight(int32_t sval);

int32_t YamlSourceNumRefDecode(const YAML::Node& node);
std::string YamlSourceNumRefEncode(int32_t sval);

Expand Down

0 comments on commit a1e9613

Please sign in to comment.