fix(bw): unable to select GV as source for weight/offset/curve in input/mix (#5386)

This commit is contained in:
philmoz
2024-08-07 20:07:36 +10:00
committed by GitHub
parent 48977acfc4
commit 5e745df8c1
17 changed files with 66 additions and 53 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr,
uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t value,
int16_t min, int16_t max, LcdFlags attr, event_t event,
IsValueAvailable isValueAvailable, int16_t sourceMin);
IsValueAvailable isValueAvailable, int16_t sourceMin, int16_t sourceMax);
#if defined(GVARS)
@@ -201,7 +201,7 @@ void showAlertBox(const char * title, const char * text, const char * action , u
#define IS_OTHER_VIEW_DISPLAYED() menuHandlers[0] == menuChannelsView
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags,
IsValueAvailable isValueAvailable, int16_t sourceMin);
IsValueAvailable isValueAvailable, int16_t sourceMin, int16_t sourceMax);
#if defined(FLIGHT_MODES)
void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
+3 -3
View File
@@ -117,12 +117,12 @@ void menuModelExpoOne(event_t event)
case EXPO_FIELD_WEIGHT:
ed->weight = editSrcVarFieldValue(EXPO_ONE_2ND_COLUMN, y, STR_WEIGHT, ed->weight,
-100, 100, attr, event, isSourceAvailableInInputs, INPUTSRC_FIRST);
-100, 100, attr, event, isSourceAvailableInInputs, INPUTSRC_FIRST, INPUTSRC_LAST);
break;
case EXPO_FIELD_OFFSET:
ed->offset = editSrcVarFieldValue(EXPO_ONE_2ND_COLUMN, y, STR_OFFSET, ed->offset,
-100, 100, attr, event, isSourceAvailableInInputs, INPUTSRC_FIRST);
-100, 100, attr, event, isSourceAvailableInInputs, INPUTSRC_FIRST, INPUTSRC_LAST);
break;
case EXPO_FIELD_CURVE_LABEL:
@@ -130,7 +130,7 @@ void menuModelExpoOne(event_t event)
break;
case EXPO_FIELD_CURVE:
editCurveRef(FW + 1, y, ed->curve, event, attr, isSourceAvailableInInputs, INPUTSRC_FIRST);
editCurveRef(FW + 1, y, ed->curve, event, attr, isSourceAvailableInInputs, INPUTSRC_FIRST, INPUTSRC_LAST);
break;
#if defined(FLIGHT_MODES)
+3 -3
View File
@@ -140,12 +140,12 @@ void menuModelMixOne(event_t event)
case MIX_FIELD_WEIGHT:
md2->weight = editSrcVarFieldValue(MIXES_2ND_COLUMN, y, STR_WEIGHT, md2->weight,
MIX_WEIGHT_MIN, MIX_WEIGHT_MAX, attr, event, isSourceAvailable, 1);
MIX_WEIGHT_MIN, MIX_WEIGHT_MAX, attr, event, isSourceAvailable, 1, MIXSRC_LAST);
break;
case MIX_FIELD_OFFSET:
md2->offset = editSrcVarFieldValue(MIXES_2ND_COLUMN, y, STR_OFFSET, md2->offset,
MIX_OFFSET_MIN, MIX_OFFSET_MAX, attr, event, isSourceAvailable, 1);
MIX_OFFSET_MIN, MIX_OFFSET_MAX, attr, event, isSourceAvailable, 1, MIXSRC_LAST);
drawOffsetBar(LCD_W - 33, y, md2);
break;
@@ -159,7 +159,7 @@ void menuModelMixOne(event_t event)
lcdDrawTextAlignedLeft(y, STR_CURVE);
s_currSrcRaw = md2->srcRaw;
s_currScale = 0;
editCurveRef(MIXES_2ND_COLUMN, y, md2->curve, event, attr, isSourceAvailable, 1);
editCurveRef(MIXES_2ND_COLUMN, y, md2->curve, event, attr, isSourceAvailable, 1, MIXSRC_LAST);
break;
#if defined(FLIGHT_MODES)
+5 -4
View File
@@ -164,7 +164,7 @@ void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t value,
int16_t min, int16_t max, LcdFlags attr, event_t event,
IsValueAvailable isValueAvailable, int16_t sourceMin)
IsValueAvailable isValueAvailable, int16_t sourceMin, int16_t sourceMax)
{
if (title)
lcdDrawTextAlignedLeft(y, title);
@@ -173,14 +173,15 @@ uint16_t editSrcVarFieldValue(coord_t x, coord_t y, const char* title, uint16_t
if (v.isSource) {
drawSource(x, y, v.value, attr);
if (attr & (~RIGHT)) {
value = checkIncDec(event, value, sourceMin, MIXSRC_LAST,
value = checkIncDec(event, value, sourceMin, sourceMax,
EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_VALUE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS, isValueAvailable);
}
} else {
lcdDrawNumber(x, y, v.value, attr);
if (attr & (~RIGHT)) {
value = checkIncDec(event, value, min, max,
EE_MODEL|INCDEC_SOURCE_VALUE|NO_INCDEC_MARKS|(sourceMin == INPUTSRC_FIRST ? INCDEC_SOURCE_NOINPUTS : 0));
value = checkIncDec(event, value, min, max, sourceMin, sourceMax,
EE_MODEL|INCDEC_SOURCE_VALUE|NO_INCDEC_MARKS,
isValueAvailable);
}
}
return value;