diff --git a/companion/src/firmwares/edgetx/yaml_ops.h b/companion/src/firmwares/edgetx/yaml_ops.h index cbd323c0a..9b5c81d26 100644 --- a/companion/src/firmwares/edgetx/yaml_ops.h +++ b/companion/src/firmwares/edgetx/yaml_ops.h @@ -115,14 +115,14 @@ namespace YAML { Node operator << (const YamlLookupTable& lut, const int& value); -template +template struct convert_enum { - static YAML::Node encode(const T& rhs) + static YAML::Node encode(const YamlLookupTable& lut, const T& rhs) { return lut << rhs; } - static bool decode(const YAML::Node& node, T& rhs) + static bool decode(const YAML::Node& node, const YamlLookupTable& lut, T& rhs) { if (node) { YAML::Node conv = node >> lut; @@ -141,10 +141,10 @@ struct convert_enum struct convert { \ static YAML::Node encode(const enum_type& rhs) \ { \ - return convert_enum::encode(rhs); \ + return convert_enum::encode(lut,rhs); \ } \ static bool decode(const YAML::Node& node, enum_type& rhs) \ { \ - return convert_enum::decode(node, rhs); \ + return convert_enum::decode(node, lut, rhs); \ } \ }