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
@@ -96,7 +96,8 @@ void menuModelCurvesAll(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags)
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags,
|
||||
IsValueAvailable isValueAvailable, int16_t sourceMin)
|
||||
{
|
||||
coord_t x1 = x;
|
||||
LcdFlags flags1 = flags;
|
||||
@@ -126,24 +127,36 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
|
||||
switch (curve.type) {
|
||||
case CURVE_REF_DIFF:
|
||||
case CURVE_REF_EXPO:
|
||||
curve.value = GVAR_MENU_ITEM(x, y, curve.value, -100, 100, LEFT | flags, 0, event);
|
||||
curve.value = editSrcVarFieldValue(x, y, nullptr, curve.value, -100, 100, flags, event, isValueAvailable, sourceMin);
|
||||
break;
|
||||
case CURVE_REF_FUNC:
|
||||
lcdDrawTextAtIndex(x, y, STR_VCURVEFUNC, curve.value, flags);
|
||||
if (active && menuHorizontalPosition==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
{
|
||||
SourceNumVal v;
|
||||
v.rawValue = curve.value;
|
||||
lcdDrawTextAtIndex(x, y, STR_VCURVEFUNC, v.value, flags);
|
||||
if (active && menuHorizontalPosition==1) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, v.value, CURVE_BASE-1);
|
||||
curve.value = v.rawValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CURVE_REF_CUSTOM:
|
||||
drawCurveName(x, y, curve.value, flags);
|
||||
{
|
||||
SourceNumVal v;
|
||||
v.rawValue = curve.value;
|
||||
drawCurveName(x, y, v.value, flags);
|
||||
if (active && menuHorizontalPosition == 1) {
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && curve.value != 0) {
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && v.value != 0) {
|
||||
s_currIdxSubMenu = abs(curve.value) - 1;
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR(event, curve.value, -MAX_CURVES, MAX_CURVES);
|
||||
CHECK_INCDEC_MODELVAR(event, v.value, -MAX_CURVES, MAX_CURVES);
|
||||
curve.value = v.rawValue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user