feat: use any source for expo/weight/offset (#5220)
Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: 3djc <3djc@gh.com> Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
co-authored by
philmoz
3djc
elecpower
parent
326c58a7fd
commit
4b917b762c
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#define EXPO_ONE_2ND_COLUMN (7*FW+3*FW+2)
|
||||
#define EXPO_ONE_2ND_COLUMN (6*FW+1)
|
||||
|
||||
int expoFn(int x)
|
||||
{
|
||||
@@ -91,39 +91,39 @@ void menuModelExpoOne(event_t event)
|
||||
|
||||
switch (i) {
|
||||
case EXPO_FIELD_INPUT_NAME:
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN - LEN_INPUT_NAME * FW, y,
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN, y,
|
||||
STR_INPUTNAME, g_model.inputNames[ed->chn],
|
||||
LEN_INPUT_NAME, event, (attr != 0), old_editMode);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_LINE_NAME:
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN - LEN_EXPOMIX_NAME * FW, y,
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN, y,
|
||||
STR_EXPONAME, ed->name, LEN_EXPOMIX_NAME, event,
|
||||
(attr != 0), old_editMode);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_SOURCE);
|
||||
drawSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, RIGHT|STREXPANDED|attr);
|
||||
drawSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|attr);
|
||||
if (attr)
|
||||
ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS, isSourceAvailableInInputs);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_SCALE:
|
||||
lcdDrawTextAlignedLeft(y, STR_SCALE);
|
||||
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN, y, (abs(ed->srcRaw) - MIXSRC_FIRST_TELEM)/3, convertTelemValue(abs(ed->srcRaw) - MIXSRC_FIRST_TELEM + 1, ed->scale), RIGHT | attr);
|
||||
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN, y, (abs(ed->srcRaw) - MIXSRC_FIRST_TELEM)/3, convertTelemValue(abs(ed->srcRaw) - MIXSRC_FIRST_TELEM + 1, ed->scale), attr);
|
||||
if (attr)
|
||||
ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(abs(ed->srcRaw) - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_WEIGHT:
|
||||
lcdDrawTextAlignedLeft(y, STR_WEIGHT);
|
||||
ed->weight = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->weight, -100, 100, RIGHT | attr, 0, event);
|
||||
ed->weight = editSrcVarFieldValue(EXPO_ONE_2ND_COLUMN, y, STR_WEIGHT, ed->weight,
|
||||
-100, 100, attr, event, isSourceAvailableInInputs, INPUTSRC_FIRST);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_OFFSET:
|
||||
lcdDrawTextAlignedLeft(y, STR_OFFSET);
|
||||
ed->offset = GVAR_MENU_ITEM(EXPO_ONE_2ND_COLUMN, y, ed->offset, -100, 100, RIGHT | attr, 0, event);
|
||||
ed->offset = editSrcVarFieldValue(EXPO_ONE_2ND_COLUMN, y, STR_OFFSET, ed->offset,
|
||||
-100, 100, attr, event, isSourceAvailableInInputs, INPUTSRC_FIRST);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_CURVE_LABEL:
|
||||
@@ -131,7 +131,7 @@ void menuModelExpoOne(event_t event)
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_CURVE:
|
||||
editCurveRef(EXPO_ONE_2ND_COLUMN, y, ed->curve, event, RIGHT | attr);
|
||||
editCurveRef(FW + 1, y, ed->curve, event, attr, isSourceAvailableInInputs, INPUTSRC_FIRST);
|
||||
break;
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
@@ -140,23 +140,23 @@ void menuModelExpoOne(event_t event)
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_FLIGHT_MODES:
|
||||
ed->flightModes = editFlightModes(EXPO_ONE_2ND_COLUMN-9*FW+1, y, event, ed->flightModes, attr);
|
||||
ed->flightModes = editFlightModes(EXPO_ONE_2ND_COLUMN-5*FW-2, y, event, ed->flightModes, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EXPO_FIELD_SWITCH:
|
||||
ed->swtch = editSwitch(EXPO_ONE_2ND_COLUMN, y, ed->swtch, RIGHT | attr, event);
|
||||
ed->swtch = editSwitch(EXPO_ONE_2ND_COLUMN, y, ed->swtch, attr, event);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_SIDE:
|
||||
ed->mode = 4 - editChoice(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VCURVEFUNC, 4-ed->mode, 1, 3, RIGHT | attr, event);
|
||||
ed->mode = 4 - editChoice(EXPO_ONE_2ND_COLUMN, y, STR_SIDE, STR_VCURVEFUNC, 4-ed->mode, 1, 3, attr, event);
|
||||
break;
|
||||
|
||||
case EXPO_FIELD_TRIM:
|
||||
lcdDrawTextAlignedLeft(y, STR_TRIM);
|
||||
{
|
||||
const char* trim_str = getTrimSourceLabel(abs(ed->srcRaw), ed->trimSource);
|
||||
LcdFlags flags = RIGHT | (menuHorizontalPosition==0 ? attr : 0);
|
||||
LcdFlags flags = (menuHorizontalPosition==0 ? attr : 0);
|
||||
lcdDrawText(EXPO_ONE_2ND_COLUMN, y, trim_str, flags);
|
||||
|
||||
if (attr) {
|
||||
|
||||
Reference in New Issue
Block a user