From af00d03640428c009e26af029ddcddeb6464852f Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 27 Dec 2021 09:07:02 +0100 Subject: [PATCH] Fixed special switches and play value, volume & backlight custom functions --- .../src/firmwares/edgetx/yaml_customfunctiondata.cpp | 12 ++++++++++++ companion/src/firmwares/edgetx/yaml_rawswitch.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp b/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp index d115457c3..010095551 100644 --- a/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp +++ b/companion/src/firmwares/edgetx/yaml_customfunctiondata.cpp @@ -171,6 +171,11 @@ Node convert::encode(const CustomFunctionData& rhs) def += ","; def += std::to_string(rhs.param); } break; + case FuncPlayValue: + case FuncVolume: + case FuncBacklight: { + def += YamlRawSourceEncode(RawSource(rhs.param)); + } break; case FuncAdjustGV1: { // + GV # def += std::to_string(p1); @@ -280,6 +285,13 @@ bool convert::decode(const Node& node, rhs.func = (AssignFunc)((int)rhs.func + tmr); def >> rhs.param; } break; + case FuncPlayValue: + case FuncVolume: + case FuncBacklight: { + std::string src_str; + getline(def, src_str, ','); + rhs.param = YamlRawSourceDecode(src_str).toValue(); + } break; case FuncAdjustGV1: { // + GV # int gvar_idx=0; diff --git a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp index 686736e6e..0d1ee3c89 100644 --- a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp @@ -68,7 +68,7 @@ std::string YamlRawSwitchEncode(const RawSwitch& rhs) break; default: - sw_str += getCurrentFirmware()->getRawSwitchTypesTag(sval); + sw_str += getCurrentFirmware()->getRawSwitchTypesTag(rhs.type); break; } return sw_str;