From b644aadbaa8067640b6fddc0f37e132b0e566c68 Mon Sep 17 00:00:00 2001 From: Neil Horne <15316949+elecpower@users.noreply.github.com> Date: Thu, 13 Jun 2024 08:34:56 +1000 Subject: [PATCH] fix(cpn): binary import of multipos switches (#5169) --- companion/src/firmwares/opentx/opentxeeprom.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index a1061c02c..e6dafb015 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -349,9 +349,10 @@ class SwitchesConversionTable: public ConversionTable { } if (IS_HORUS_OR_TARANIS(board)) { + const int adc_offset = 4 * 6; // num sticks * multi pot posns as adc assumes ALL inputs can be multi pos for (int i=1; i<=MAX_XPOTS(board, version)*6; i++) { - addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i), -val+offset); - addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++); + addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i - adc_offset), -val+offset); + addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i + adc_offset), val++); } }