Fix editing slider names

previously it would edit the pot names instead
This commit is contained in:
Raphael Coeffic
2021-05-26 23:23:04 +02:00
committed by Raphael Coeffic
parent d70ac14832
commit 41826f2160
+18 -13
View File
@@ -200,19 +200,24 @@ void RadioHardwarePage::build(FormWindow * window)
new Subtitle(window, grid.getLineSlot(), STR_SLIDERS); new Subtitle(window, grid.getLineSlot(), STR_SLIDERS);
grid.nextLine(); grid.nextLine();
for (int i = 0; i < NUM_SLIDERS; i++) { 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))); const int idx = i + NUM_STICKS + NUM_POTS;
new RadioTextEdit(window, grid.getFieldSlot(2,0), g_eeGeneral.anaNames[i + NUM_STICKS], LEN_ANA_NAME); new StaticText(window, grid.getLabelSlot(true),
new Choice(window, grid.getFieldSlot(2,1), STR_SLIDERTYPES, SLIDER_NONE, SLIDER_WITH_DETENT, TEXT_AT_INDEX(STR_VSRCRAW, idx + 1));
[=]() -> int { new RadioTextEdit(window, grid.getFieldSlot(2, 0),
uint8_t mask = (0x01 << i); g_eeGeneral.anaNames[idx], LEN_ANA_NAME);
return (g_eeGeneral.slidersConfig & mask) >> i; new Choice(
}, window, grid.getFieldSlot(2, 1), STR_SLIDERTYPES, SLIDER_NONE,
[=](int newValue) { SLIDER_WITH_DETENT,
uint8_t mask = (0x01 << i); [=]() -> int {
g_eeGeneral.slidersConfig &= ~mask; uint8_t mask = (0x01 << i);
g_eeGeneral.slidersConfig |= (newValue << i); return (g_eeGeneral.slidersConfig & mask) >> i;
SET_DIRTY(); },
}); [=](int newValue) {
uint8_t mask = (0x01 << i);
g_eeGeneral.slidersConfig &= ~mask;
g_eeGeneral.slidersConfig |= (newValue << i);
SET_DIRTY();
});
grid.nextLine(); grid.nextLine();
} }