feat: customisable switch generated source groups (#5016)
Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
@@ -425,6 +425,30 @@ getvalue_t _getValue(mixsrc_t i, bool* valid)
|
||||
return _switch_3pos_lookup[switchGetPosition(sw_idx)];
|
||||
}
|
||||
}
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
else if (i <= MIXSRC_LAST_CUSTOMSWITCH_GROUP) {
|
||||
uint8_t group_idx = (uint8_t)(i - MIXSRC_FIRST_CUSTOMSWITCH_GROUP + 1);
|
||||
uint8_t stepcount = getSwitchCountInFSGroup(group_idx);
|
||||
if (stepcount == 0)
|
||||
return 0;
|
||||
|
||||
if (IS_FSWITCH_GROUP_ON(group_idx))
|
||||
stepcount--;
|
||||
|
||||
int stepsize = (2 * RESX) / stepcount;
|
||||
int value = -RESX;
|
||||
|
||||
for (uint8_t i = 0; i < switchGetMaxFctSwitches(); i++) {
|
||||
if(FSWITCH_GROUP(i) == group_idx) {
|
||||
if (getFSLogicalState(i) == 1)
|
||||
return value + (IS_FSWITCH_GROUP_ON(group_idx) ? 0 : stepsize);
|
||||
else
|
||||
value += stepsize;
|
||||
}
|
||||
}
|
||||
return -RESX;
|
||||
}
|
||||
#endif
|
||||
|
||||
else if (i <= MIXSRC_LAST_LOGICAL_SWITCH) {
|
||||
return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH + i - MIXSRC_FIRST_LOGICAL_SWITCH) ? 1024 : -1024;
|
||||
|
||||
Reference in New Issue
Block a user