[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:
committed by
Bertrand Songis
parent
716a91fc0c
commit
b69f36afe4
@@ -119,9 +119,10 @@ bool menuModelLogicalSwitches(event_t event)
|
||||
|
||||
// CSW params
|
||||
cstate = lswFamily(cs->func);
|
||||
int v1_val=cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM;
|
||||
int v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||
int v3_min=-1, v3_max=100;
|
||||
int v1_val = cs->v1;
|
||||
int16_t v1_min = 0, v1_max = MIXSRC_LAST_TELEM;
|
||||
int16_t v2_min = 0, v2_max = MIXSRC_LAST_TELEM;
|
||||
int16_t v3_min =-1, v3_max = 100;
|
||||
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||
@@ -172,9 +173,9 @@ bool menuModelLogicalSwitches(event_t event)
|
||||
INCDEC_SET_FLAG(EE_MODEL);
|
||||
INCDEC_ENABLE_CHECK(NULL);
|
||||
}
|
||||
v2_max = getMaximumValue(v1_val);
|
||||
v2_min = -v2_max;
|
||||
drawSourceCustomValue(CSW_3RD_COLUMN, y, v1_val, v1_val <= MIXSRC_LAST_CH ? calc100toRESX(cs->v2) : cs->v2, LEFT|attr2);
|
||||
LcdFlags lf = attr2 | LEFT;
|
||||
getMixSrcRange(v1_val, v2_min, v2_max, &lf);
|
||||
drawSourceCustomValue(CSW_3RD_COLUMN, y, v1_val, (v1_val <= MIXSRC_LAST_CH ? calc100toRESX(cs->v2) : cs->v2), lf);
|
||||
}
|
||||
|
||||
// CSW AND switch
|
||||
|
||||
@@ -259,7 +259,7 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
}
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
|
||||
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
#endif
|
||||
@@ -270,9 +270,8 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
}
|
||||
#endif
|
||||
else if (func == FUNC_SET_TIMER) {
|
||||
// TODO 539 ? TIMEHOUR ?
|
||||
val_max = 59*60+59;
|
||||
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
getMixSrcRange(MIXSRC_FIRST_TIMER, val_min, val_max);
|
||||
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT|TIMEHOUR);
|
||||
}
|
||||
else if (func == FUNC_PLAY_SOUND) {
|
||||
val_max = AU_SPECIAL_SOUND_LAST-AU_SPECIAL_SOUND_FIRST-1;
|
||||
@@ -341,11 +340,9 @@ bool menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
switch (CFN_GVAR_MODE(cfn)) {
|
||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||
{
|
||||
uint8_t gvar_index = CFN_GVAR_INDEX(cfn);
|
||||
val_displayed = (int16_t) CFN_PARAM(cfn);
|
||||
val_min = max<int16_t>(CFN_GVAR_CST_MIN, MODEL_GVAR_MIN(gvar_index));
|
||||
val_max = min<int16_t>(CFN_GVAR_CST_MAX, MODEL_GVAR_MAX(gvar_index));
|
||||
drawGVarValue(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, gvar_index, val_displayed, attr|LEFT);
|
||||
val_displayed = (int16_t)CFN_PARAM(cfn);
|
||||
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);
|
||||
break;
|
||||
}
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
@@ -361,11 +358,8 @@ bool 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
|
||||
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);
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user