[Radio] Adjust value limits for mix sources and update UI for LSs, CFs & telem. (#5445)

* [firmware][ARM] Adjust some value limits for mix sources and update editing UI for LSs, CFs, & telem. bars:
    * Increase timer limits to +/-8:59:59 when used with LSs, CFs, & bars;
    * Increase Lua script output limits to +/-30K;
    * Trim limits based on extended limit model setting;
    * Limit TX voltage to 25.5;
    * Limit TX time comparison value to 29:59m;
    * Use proper GVar limits (user-configured), display precision, & unit in LSs & telem. bars;
    * Display timer values properly with hours (instead of mmm:ss).

* [firmware] getTimerString() would fail with times >= 100min if hours weren't shown.

* Fix builds w/out GVars.
This commit is contained in:
Max Paperno
2017-12-19 12:17:12 +01:00
committed by Bertrand Songis
parent 716a91fc0c
commit b69f36afe4
11 changed files with 134 additions and 101 deletions
@@ -298,10 +298,12 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
}
#if defined(OVERRIDE_CHANNEL_FUNCTION)
else if (func == FUNC_OVERRIDE_CHANNEL) {
#if !defined(CPUARM)
#if defined(CPUARM)
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
#else
val_displayed = (int8_t)CFN_PARAM(cfn);
#endif
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
#endif
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
}
#endif // OVERRIDE_CHANNEL_FUNCTION
@@ -311,7 +313,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "\004Int.Ext.", CFN_PARAM(cfn), attr);
}
else if (func == FUNC_SET_TIMER) {
val_max = 539*60+59;
getMixSrcRange(MIXSRC_FIRST_TIMER, val_min, val_max);
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr);
}
#endif
@@ -400,7 +402,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
}
#endif
#endif // CPUARM
#if defined(SDCARD)
else if (func == FUNC_LOGS) {
if (val_displayed) {
@@ -417,8 +419,13 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
switch (CFN_GVAR_MODE(cfn)) {
case FUNC_ADJUST_GVAR_CONSTANT:
val_displayed = (int16_t)CFN_PARAM(cfn);
#if defined(CPUARM)
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
drawGVarValue(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_GVAR_INDEX(cfn), val_displayed, attr|LEFT);
#else
val_min = -CFN_GVAR_CST_MAX; val_max = +CFN_GVAR_CST_MAX;
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
#endif // CPUARM
break;
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH;
@@ -433,17 +440,14 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
#if defined(PCBX7)
val_min = -100; val_max = +100;
if (val_displayed < 0)
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "-= ", attr);
else
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "+= ", attr);
#if defined(CPUARM)
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, (val_displayed < 0 ? "-= " : "+= "), attr);
drawGVarValue(lcdNextPos, y, CFN_GVAR_INDEX(cfn), abs(val_displayed), attr|LEFT);
#else
val_max = 1;
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
#endif // PCBX7
#endif // CPUARM
break;
}