Fixed autosource
This commit is contained in:
committed by
Raphael Coeffic
parent
92e8baf916
commit
9ea11b40bb
@@ -72,6 +72,9 @@ void SourceChoice::paint(BitmapBuffer * dc)
|
|||||||
drawSource(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
|
drawSource(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// defined in gui/gui_common.cpp
|
||||||
|
uint8_t switchToMix(uint8_t source);
|
||||||
|
|
||||||
void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & filter)
|
void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & filter)
|
||||||
{
|
{
|
||||||
auto value = getValue();
|
auto value = getValue();
|
||||||
@@ -95,7 +98,7 @@ void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & fi
|
|||||||
|
|
||||||
#if defined(AUTOSOURCE)
|
#if defined(AUTOSOURCE)
|
||||||
menu->setWaitHandler([=]() {
|
menu->setWaitHandler([=]() {
|
||||||
int16_t val = getMovedSource(0);
|
int16_t val = getMovedSource(vmin);
|
||||||
if (val) {
|
if (val) {
|
||||||
if (filter && filter(val)) {
|
if (filter && filter(val)) {
|
||||||
return;
|
return;
|
||||||
@@ -105,17 +108,19 @@ void SourceChoice::fillMenu(Menu * menu, const std::function<bool(int16_t)> & fi
|
|||||||
}
|
}
|
||||||
this->fillMenu(menu);
|
this->fillMenu(menu);
|
||||||
}
|
}
|
||||||
|
#if defined(AUTOSWITCH)
|
||||||
else {
|
else {
|
||||||
swsrc_t swtch = getMovedSwitch();
|
swsrc_t swtch = abs(getMovedSwitch());
|
||||||
if (swtch) {
|
if (swtch && !IS_SWITCH_MULTIPOS(swtch)) {
|
||||||
div_t info = switchInfo(swtch);
|
val = switchToMix(swtch);
|
||||||
val = info.quot + MIXSRC_FIRST_SWITCH;
|
if (val && (val >= vmin) && (val <= vmax)
|
||||||
if (val && (!filter || !filter(val))) {
|
&& (!filter || !filter(val))) {
|
||||||
if (setValue) setValue(val);
|
if (setValue) setValue(val);
|
||||||
this->fillMenu(menu);
|
this->fillMenu(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user