From c0a94505b61c13721ab96cbece51e1662a99e79d Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 20 Nov 2019 21:10:30 +0100 Subject: [PATCH] Issue with function "Trainer Chans" (#7104) TRAINER(Channels) had a 50% weight --- radio/src/functions.cpp | 6 +++--- .../gui/128x64/model_special_functions.cpp | 10 ++++++---- .../gui/212x64/model_special_functions.cpp | 10 ++++++---- .../gui/480x272/model_special_functions.cpp | 8 +++++--- radio/src/mixer.cpp | 20 +++++++++---------- radio/src/translations.cpp | 1 + radio/src/translations.h | 1 + radio/src/translations/cz.h.txt | 3 ++- radio/src/translations/de.h.txt | 3 ++- radio/src/translations/en.h.txt | 3 ++- radio/src/translations/es.h.txt | 1 + radio/src/translations/fi.h.txt | 3 ++- radio/src/translations/fr.h.txt | 1 + radio/src/translations/it.h.txt | 3 ++- radio/src/translations/nl.h.txt | 3 ++- radio/src/translations/pl.h.txt | 3 ++- radio/src/translations/pt.h.txt | 5 +++-- radio/src/translations/se.h.txt | 1 + 18 files changed, 52 insertions(+), 33 deletions(-) diff --git a/radio/src/functions.cpp b/radio/src/functions.cpp index 0f93ca786..0d1ebbf38 100644 --- a/radio/src/functions.cpp +++ b/radio/src/functions.cpp @@ -169,14 +169,14 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext if (param == 0) newActiveFunctions |= 0x0F; else if (param <= NUM_STICKS) - newActiveFunctions |= (1 << (param-1)); + newActiveFunctions |= (1 << (param - 1)); else if (param == NUM_STICKS + 1) - newActiveFunctions |= (1 << FUNCTION_TRAINER_CHANNELS); + newActiveFunctions |= (1u << FUNCTION_TRAINER_CHANNELS); break; } case FUNC_INSTANT_TRIM: - newActiveFunctions |= (1 << FUNCTION_INSTANT_TRIM); + newActiveFunctions |= (1u << FUNCTION_INSTANT_TRIM); if (!isFunctionActive(FUNCTION_INSTANT_TRIM)) { if (IS_INSTANT_TRIM_ALLOWED()) { instantTrim(); diff --git a/radio/src/gui/128x64/model_special_functions.cpp b/radio/src/gui/128x64/model_special_functions.cpp index a0472d681..bfcee26c3 100644 --- a/radio/src/gui/128x64/model_special_functions.cpp +++ b/radio/src/gui/128x64/model_special_functions.cpp @@ -224,15 +224,17 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF if (func == FUNC_TRAINER) { maxParam = NUM_STICKS + 1; uint8_t param = CFN_CH_INDEX(cfn); - if (param == NUM_STICKS + 1) - lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "Chans", attr); + if (param == 0) + lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_STICKS, attr); + else if (param == NUM_STICKS + 1) + lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_CHANS, attr); else - drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_CH_INDEX(cfn) == 0 ? 0 : MIXSRC_Rud + CFN_CH_INDEX(cfn) - 1, attr); + drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_Rud + param - 1, attr); } #if defined(GVARS) else if (func == FUNC_ADJUST_GVAR) { maxParam = MAX_GVARS-1; - drawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr); + drawStringWithIndex(lcdNextPos + 2, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr); if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags); break; } diff --git a/radio/src/gui/212x64/model_special_functions.cpp b/radio/src/gui/212x64/model_special_functions.cpp index eb1bcb58d..7c2d1e139 100644 --- a/radio/src/gui/212x64/model_special_functions.cpp +++ b/radio/src/gui/212x64/model_special_functions.cpp @@ -216,15 +216,17 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF if (func == FUNC_TRAINER) { maxParam = NUM_STICKS + 1; uint8_t param = CFN_CH_INDEX(cfn); - if (param == NUM_STICKS + 1) - lcdDrawText(lcdNextPos, y, "Chans", attr); + if (param == 0) + lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_STICKS, attr); + else if (param == NUM_STICKS + 1) + lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_CHANS, attr); else - drawSource(lcdNextPos, y, CFN_CH_INDEX(cfn)==0 ? 0 : MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr); + drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_Rud + param - 1, attr); } #if defined(GVARS) else if (func == FUNC_ADJUST_GVAR) { maxParam = MAX_GVARS-1; - drawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr); + drawStringWithIndex(lcdNextPos + 2, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr); if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags); break; } diff --git a/radio/src/gui/480x272/model_special_functions.cpp b/radio/src/gui/480x272/model_special_functions.cpp index f646b027c..fdc063dc9 100644 --- a/radio/src/gui/480x272/model_special_functions.cpp +++ b/radio/src/gui/480x272/model_special_functions.cpp @@ -217,10 +217,12 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF if (func == FUNC_TRAINER) { maxParam = NUM_STICKS + 1; uint8_t param = CFN_CH_INDEX(cfn); - if (param == NUM_STICKS + 1) - lcdDrawText(MODEL_SPECIAL_FUNC_2ND_COLUMN_EXT, y, "Chans", attr); + if (param == 0) + lcdDrawText(MODEL_SPECIAL_FUNC_2ND_COLUMN_EXT, y, STR_STICKS, attr); + else if (param == NUM_STICKS + 1) + lcdDrawText(MODEL_SPECIAL_FUNC_2ND_COLUMN_EXT, y, STR_CHANS, attr); else - drawSource(MODEL_SPECIAL_FUNC_2ND_COLUMN_EXT, y, CFN_CH_INDEX(cfn)==0 ? 0 : MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr); + drawSource(MODEL_SPECIAL_FUNC_2ND_COLUMN_EXT, y, MIXSRC_Rud + param - 1, attr); } #if defined(GVARS) else if (func == FUNC_ADJUST_GVAR) { diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 6d9d543cf..e4b701c9c 100644 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -232,7 +232,7 @@ int16_t applyLimits(uint8_t channel, int32_t value) #endif if (isFunctionActive(FUNCTION_TRAINER_CHANNELS) && IS_TRAINER_INPUT_VALID()) { - return ppmInput[channel]; + return ppmInput[channel] * 2; } LimitData * lim = limitAddress(channel); @@ -369,22 +369,22 @@ getvalue_t getValue(mixsrc_t i) #endif else if (i <= MIXSRC_LAST_LOGICAL_SWITCH) { - return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH+i-MIXSRC_FIRST_LOGICAL_SWITCH) ? 1024 : -1024; + return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH + i - MIXSRC_FIRST_LOGICAL_SWITCH) ? 1024 : -1024; } else if (i <= MIXSRC_LAST_TRAINER) { - int16_t x = ppmInput[i-MIXSRC_FIRST_TRAINER]; - if (i