Trainer function can now replace the channels values instead of to the sticks positions (#6561)

This commit is contained in:
Bertrand Songis
2019-10-24 12:03:19 +02:00
committed by GitHub
parent 9831a796b7
commit 1b35f2bd35
6 changed files with 47 additions and 26 deletions
+7 -5
View File
@@ -165,11 +165,13 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
case FUNC_TRAINER:
{
uint8_t mask = 0x0f;
if (CFN_CH_INDEX(cfn) > 0) {
mask = (1<<(CFN_CH_INDEX(cfn)-1));
}
newActiveFunctions |= mask;
uint8_t param = CFN_CH_INDEX(cfn);
if (param == 0)
newActiveFunctions |= 0x0F;
else if (param <= NUM_STICKS)
newActiveFunctions |= (1 << (param-1));
else if (param == NUM_STICKS + 1)
newActiveFunctions |= (1 << FUNCTION_TRAINER_CHANNELS);
break;
}