diff --git a/companion/src/firmwares/edgetx/yaml_switchconfig.cpp b/companion/src/firmwares/edgetx/yaml_switchconfig.cpp index f8892d819..7ba57903a 100644 --- a/companion/src/firmwares/edgetx/yaml_switchconfig.cpp +++ b/companion/src/firmwares/edgetx/yaml_switchconfig.cpp @@ -96,6 +96,10 @@ int YamlPotLookup::name2idx(const std::string& name) int idx = fw->getAnalogInputIndex(name.c_str()); if (idx < 0) return idx; + int sticks = Boards::getCapability(fw->getBoard(), Board::Sticks); + if (idx < sticks) return -1; + idx -= sticks; + int pots = Boards::getCapability(fw->getBoard(), Board::Pots); if (idx >= pots) return -1; @@ -108,7 +112,8 @@ std::string YamlPotLookup::idx2name(unsigned int idx) unsigned int pots = Boards::getCapability(fw->getBoard(), Board::Pots); if (idx >= pots) return std::string(); - return fw->getAnalogInputTag(idx); + unsigned int sticks = Boards::getCapability(fw->getBoard(), Board::Sticks); + return fw->getAnalogInputTag(idx + sticks); } int YamlSliderLookup::name2idx(const std::string& name) @@ -117,6 +122,10 @@ int YamlSliderLookup::name2idx(const std::string& name) int idx = fw->getAnalogInputIndex(name.c_str()); if (idx < 0) return idx; + int sticks = Boards::getCapability(fw->getBoard(), Board::Sticks); + if (idx < sticks) return -1; + idx -= sticks; + int pots = Boards::getCapability(fw->getBoard(), Board::Pots); if (idx < pots) return -1; idx -= pots; @@ -130,9 +139,10 @@ int YamlSliderLookup::name2idx(const std::string& name) std::string YamlSliderLookup::idx2name(unsigned int idx) { auto fw = getCurrentFirmware(); - int pots = Boards::getCapability(fw->getBoard(), Board::Pots); unsigned int sliders = Boards::getCapability(fw->getBoard(), Board::Sliders); if (idx >= sliders) return std::string(); - return fw->getAnalogInputTag(idx + pots); + unsigned int sticks = Boards::getCapability(fw->getBoard(), Board::Sticks); + unsigned int pots = Boards::getCapability(fw->getBoard(), Board::Pots); + return fw->getAnalogInputTag(idx + pots + sticks); } diff --git a/companion/src/firmwares/edgetx/yaml_switchconfig.h b/companion/src/firmwares/edgetx/yaml_switchconfig.h index 37e3e5fd3..c5240e4e4 100644 --- a/companion/src/firmwares/edgetx/yaml_switchconfig.h +++ b/companion/src/firmwares/edgetx/yaml_switchconfig.h @@ -110,7 +110,7 @@ struct convert > { Node node; for (unsigned int i=0; i > { Node node; for (unsigned int i=0; i