From b8553928edca7d348b4947baa7b2f93dd59449b9 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sun, 16 Jan 2022 10:49:23 +0100 Subject: [PATCH] Fix trim switch index --- companion/src/firmwares/edgetx/yaml_rawswitch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp index d1e7e6a3f..0b83ea70c 100644 --- a/companion/src/firmwares/edgetx/yaml_rawswitch.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawswitch.cpp @@ -50,7 +50,7 @@ std::string YamlRawSwitchEncode(const RawSwitch& rhs) break; case SWITCH_TYPE_TRIM: - sw_str += getCurrentFirmware()->getTrimSwitchesTag(sval); + sw_str += getCurrentFirmware()->getTrimSwitchesTag(sval - 1); break; case SWITCH_TYPE_FLIGHT_MODE: @@ -132,7 +132,7 @@ RawSwitch YamlRawSwitchDecode(const std::string& sw_str) int tsw_idx = getCurrentFirmware()->getTrimSwitchesIndex(sw_str_tmp.c_str()); if (tsw_idx >= 0) { rhs.type = SWITCH_TYPE_TRIM; - rhs.index = tsw_idx; + rhs.index = tsw_idx + 1; } } else if (val_len >= 3 && val[0] == 'S' &&