mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 01:05:10 +03:00
[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:
parent
716a91fc0c
commit
b69f36afe4
11 changed files with 134 additions and 101 deletions
|
@ -1016,17 +1016,55 @@ extern uint16_t BandGap;
|
|||
int expo(int x, int k);
|
||||
|
||||
#if defined(CPUARM)
|
||||
inline int getMaximumValue(int source)
|
||||
{
|
||||
if (source < MIXSRC_FIRST_CH)
|
||||
return 100;
|
||||
else if (source <= MIXSRC_LAST_CH)
|
||||
return g_model.extendedLimits ? 150 : 100;
|
||||
else if (source >= MIXSRC_FIRST_TIMER && source <= MIXSRC_LAST_TIMER)
|
||||
return (23*60)+59;
|
||||
else
|
||||
return 30000;
|
||||
inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0)
|
||||
{
|
||||
if (source >= MIXSRC_FIRST_TRIM && source <= MIXSRC_LAST_TRIM) {
|
||||
valMax = g_model.extendedTrims ? TRIM_EXTENDED_MAX : TRIM_MAX;
|
||||
valMin = -valMax;
|
||||
}
|
||||
#if defined(LUA_INPUTS)
|
||||
else if (source >= MIXSRC_FIRST_LUA && source <= MIXSRC_LAST_LUA) {
|
||||
valMax = 30000;
|
||||
valMin = -valMax;
|
||||
}
|
||||
#endif
|
||||
else if (source < MIXSRC_FIRST_CH) {
|
||||
valMax = 100;
|
||||
valMin = -valMax;
|
||||
}
|
||||
else if (source <= MIXSRC_LAST_CH) {
|
||||
valMax = g_model.extendedLimits ? LIMIT_EXT_PERCENT : 100;
|
||||
valMin = -valMax;
|
||||
}
|
||||
#if defined(GVARS)
|
||||
else if (source >= MIXSRC_FIRST_GVAR && source <= MIXSRC_LAST_GVAR) {
|
||||
valMax = min<int>(CFN_GVAR_CST_MAX, MODEL_GVAR_MAX(source-MIXSRC_FIRST_GVAR));
|
||||
valMin = max<int>(CFN_GVAR_CST_MIN, MODEL_GVAR_MIN(source-MIXSRC_FIRST_GVAR));
|
||||
if (flags && g_model.gvars[source-MIXSRC_FIRST_GVAR].prec)
|
||||
*flags |= PREC1;
|
||||
}
|
||||
#endif
|
||||
else if (source == MIXSRC_TX_VOLTAGE) {
|
||||
valMax = 255;
|
||||
valMin = 0;
|
||||
if (flags)
|
||||
*flags |= PREC1;
|
||||
}
|
||||
else if (source == MIXSRC_TX_TIME) {
|
||||
valMax = 23 * 60 + 59;
|
||||
valMin = 0;
|
||||
}
|
||||
else if (source >= MIXSRC_FIRST_TIMER && source <= MIXSRC_LAST_TIMER) {
|
||||
valMax = 9 * 60 * 60 - 1;
|
||||
valMin = -valMax;
|
||||
if (flags)
|
||||
*flags |= TIMEHOUR;
|
||||
}
|
||||
else {
|
||||
valMax = 30000;
|
||||
valMin = -valMax;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Curves
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue