From 41826f21606cfe7dc58fc9a3935f11af4ea7de78 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Wed, 26 May 2021 22:38:29 +0200 Subject: [PATCH] Fix editing slider names previously it would edit the pot names instead --- radio/src/gui/colorlcd/radio_hardware.cpp | 31 +++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/radio/src/gui/colorlcd/radio_hardware.cpp b/radio/src/gui/colorlcd/radio_hardware.cpp index d050eba19..b5c264846 100644 --- a/radio/src/gui/colorlcd/radio_hardware.cpp +++ b/radio/src/gui/colorlcd/radio_hardware.cpp @@ -200,19 +200,24 @@ void RadioHardwarePage::build(FormWindow * window) new Subtitle(window, grid.getLineSlot(), STR_SLIDERS); grid.nextLine(); for (int i = 0; i < NUM_SLIDERS; i++) { - new StaticText(window, grid.getLabelSlot(true), TEXT_AT_INDEX(STR_VSRCRAW, (i + NUM_STICKS + NUM_POTS + 1))); - new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME); - new Choice(window, grid.getFieldSlot(2,1), STR_SLIDERTYPES, SLIDER_NONE, SLIDER_WITH_DETENT, - [=]() -> int { - uint8_t mask = (0x01 << i); - return (g_eeGeneral.slidersConfig & mask) >> i; - }, - [=](int newValue) { - uint8_t mask = (0x01 << i); - g_eeGeneral.slidersConfig &= ~mask; - g_eeGeneral.slidersConfig |= (newValue << i); - SET_DIRTY(); - }); + const int idx = i + NUM_STICKS + NUM_POTS; + new StaticText(window, grid.getLabelSlot(true), + TEXT_AT_INDEX(STR_VSRCRAW, idx + 1)); + new RadioTextEdit(window, grid.getFieldSlot(2, 0), + g_eeGeneral.anaNames[idx], LEN_ANA_NAME); + new Choice( + window, grid.getFieldSlot(2, 1), STR_SLIDERTYPES, SLIDER_NONE, + SLIDER_WITH_DETENT, + [=]() -> int { + uint8_t mask = (0x01 << i); + return (g_eeGeneral.slidersConfig & mask) >> i; + }, + [=](int newValue) { + uint8_t mask = (0x01 << i); + g_eeGeneral.slidersConfig &= ~mask; + g_eeGeneral.slidersConfig |= (newValue << i); + SET_DIRTY(); + }); grid.nextLine(); }