[Taranis] Switches selection menu

This commit is contained in:
bsongis
2015-06-16 18:10:16 +02:00
parent 0283096ac7
commit 07444b002c
16 changed files with 117 additions and 34 deletions
+9 -4
View File
@@ -183,6 +183,12 @@ enum SwitchContext
MixesContext
};
bool isLogicalSwitchAvailable(int index)
{
LogicalSwitchData * lsw = lswAddress(index);
return (lsw->func != LS_FUNC_NONE);
}
bool isSwitchAvailable(int swtch, SwitchContext context)
{
uint32_t index = switchInfo(abs(swtch)).quot;
@@ -219,8 +225,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
return false;
}
else if (context != LogicalSwitchesContext) {
LogicalSwitchData * cs = lswAddress(swtch-SWSRC_FIRST_LOGICAL_SWITCH);
return (cs->func != LS_FUNC_NONE);
return isLogicalSwitchAvailable(swtch - SWSRC_FIRST_LOGICAL_SWITCH);
}
}
@@ -344,9 +349,9 @@ bool modelHasNotes()
return isFileAvailable(filename);
}
int getFirstAvailableSource(int min, int max, bool (*func)(int))
int getFirstAvailable(int min, int max, bool (*func)(int))
{
int retval = MIXSRC_NONE;
int retval = 0;
for (int i = min; i <= max; i++) {
if ((*func)(i)) {
retval = i;