Unify throttle source check/conversion code

This commit is contained in:
Raphael Coeffic
2021-07-14 13:54:12 +02:00
committed by Raphael Coeffic
parent 2cbc7a6209
commit 90bd1b6329
7 changed files with 51 additions and 62 deletions
+8 -5
View File
@@ -442,12 +442,15 @@ bool isSwitch2POSWarningStateAvailable(int state)
// return isSwitchAvailable(swtch, TimersContext);
//}
bool isThrottleSourceAvailable(int source)
bool isThrottleSourceAvailable(int src)
{
if (source >= THROTTLE_SOURCE_FIRST_POT && source < THROTTLE_SOURCE_FIRST_POT+NUM_POTS+NUM_SLIDERS && !IS_POT_SLIDER_AVAILABLE(POT1+source-THROTTLE_SOURCE_FIRST_POT))
return false;
else
return true;
#if !defined(LIBOPENUI)
src = throttleSource2Source(src);
#endif
return isSourceAvailable(src) &&
((src == MIXSRC_Thr) ||
((src >= MIXSRC_FIRST_POT) && (src <= MIXSRC_LAST_POT)) ||
((src >= MIXSRC_FIRST_CH) && (src <= MIXSRC_LAST_CH)));
}
bool isLogicalSwitchFunctionAvailable(int function)