From 87a3d2f9e725a999e09e0cb020d00b4e05f6bd7e Mon Sep 17 00:00:00 2001 From: Neil Horne Date: Sun, 20 Mar 2022 20:18:30 +1100 Subject: [PATCH] fix: Companion decode of Act and Telemetry switches (#1708) --- companion/src/firmwares/edgetx/yaml_rawswitch.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp index 0b83ea70c..69994ec24 100644 --- a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp @@ -145,6 +145,17 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str) rhs.index = sw_idx * 3 + (val[2] - '0' + 1); } + // these types use index = 1 + } else if (val_len > 4 && ( + (val[0] == 'R' && val[1] == 'A' && val[2] == 'D' && val[3] == 'I' && val[4] == 'O') || + (val[0] == 'T' && val[1] == 'E' && val[2] == 'L' && val[3] == 'E' && val[4] == 'M'))) { + + int sw_type = getCurrentFirmware()->getRawSwitchTypesIndex(sw_str_tmp.c_str()); + if (sw_type >= 0) { + rhs.type = (RawSwitchType)sw_type; + rhs.index = 1; + } + // TODO: SWITCH_TYPE_TIMER_MODE // check as it appears to be depreciated as not in RawSwitch data model and not in radio yaml export