[color] properly filter sources in drop-downs

Resolves #731
This commit is contained in:
Raphael Coeffic
2021-09-16 09:03:17 +02:00
parent 24292d83aa
commit cfdee7f0e6
2 changed files with 18 additions and 12 deletions
+16 -12
View File
@@ -231,20 +231,24 @@ class InputEditWindow : public Page
// Source
new StaticText(window, grid.getLabelSlot(), STR_SOURCE, 0, COLOR_THEME_PRIMARY1);
new SourceChoice(window, grid.getFieldSlot(), INPUTSRC_FIRST, INPUTSRC_LAST,
GET_DEFAULT(line->srcRaw),
[=] (int32_t newValue) {
line->srcRaw = newValue;
if (line->srcRaw > MIXSRC_Ail && line->carryTrim == TRIM_ON) {
line->carryTrim = TRIM_OFF;
trimChoice->invalidate();
}
SET_DIRTY();
}
);
Choice *src = new SourceChoice(
window, grid.getFieldSlot(), INPUTSRC_FIRST, INPUTSRC_LAST,
GET_DEFAULT(line->srcRaw), [=](int32_t newValue) {
line->srcRaw = newValue;
if (line->srcRaw > MIXSRC_Ail && line->carryTrim == TRIM_ON) {
line->carryTrim = TRIM_OFF;
trimChoice->invalidate();
}
SET_DIRTY();
});
src->setAvailableHandler(
[](int v) { return isSourceAvailableInInputs(v); });
/* TODO telemetry current value
if (ed->srcRaw >= MIXSRC_FIRST_TELEM) {
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN+75, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|(menuHorizontalPosition==1?attr:0));
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN+75, y, (ed->srcRaw -
MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM +
1, ed->scale), LEFT|(menuHorizontalPosition==1?attr:0));
} */
grid.nextLine();
+2
View File
@@ -97,6 +97,8 @@ SourceChoice::SourceChoice(FormGroup *parent, const rect_t &rect, int16_t vmin,
return std::string(getSourceString(value));
});
setAvailableHandler([](int v){ return isSourceAvailable(v); });
}
void SourceChoice::fillMenu(Menu *menu,