Skip to content

Commit

Permalink
feat: allow an 'input' as the source for weight, offset and curve in …
Browse files Browse the repository at this point in the history
…input line (#5418)
  • Loading branch information
philmoz authored Aug 14, 2024
1 parent 4c30b09 commit 1024717
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion companion/src/modeledit/expodialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
setWindowTitle(tr("Edit %1").arg(RawSource(srcType, ed->chn).toString(&model, &generalSettings)));

int imId = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource),
(RawSource::AllSourceGroups & ~RawSource::NoneGroup & ~RawSource::ScriptsGroup & ~RawSource::InputsGroup)),
(RawSource::AllSourceGroups & ~RawSource::NoneGroup & ~RawSource::ScriptsGroup)),
"EditorSource");

FilteredItemModel *esMdl = dialogFilteredItemModels->getItemModel(imId);
Expand Down
6 changes: 3 additions & 3 deletions radio/src/gui/128x64/model_input_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,20 @@ 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, INPUTSRC_LAST);
-100, 100, attr, event, isSourceAvailable, MIXSRC_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, INPUTSRC_LAST);
-100, 100, attr, event, isSourceAvailable, MIXSRC_FIRST, INPUTSRC_LAST);
break;

case EXPO_FIELD_CURVE_LABEL:
lcdDrawTextAlignedLeft(y, STR_CURVE);
break;

case EXPO_FIELD_CURVE:
editCurveRef(FW + 1, y, ed->curve, event, attr, isSourceAvailableInInputs, INPUTSRC_FIRST, INPUTSRC_LAST);
editCurveRef(FW + 1, y, ed->curve, event, attr, isSourceAvailable, MIXSRC_FIRST, INPUTSRC_LAST);
break;

#if defined(FLIGHT_MODES)
Expand Down
6 changes: 3 additions & 3 deletions radio/src/gui/212x64/model_input_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ 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, INPUTSRC_LAST);
-100, 100, attr, event, isSourceAvailable, MIXSRC_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, INPUTSRC_LAST);
-100, 100, attr, event, isSourceAvailable, MIXSRC_FIRST, INPUTSRC_LAST);
break;

case EXPO_FIELD_CURVE:
lcdDrawTextAlignedLeft(y, STR_CURVE);
editCurveRef(EXPO_ONE_2ND_COLUMN, y, ed->curve, event, attr, isSourceAvailableInInputs, INPUTSRC_FIRST, INPUTSRC_LAST);
editCurveRef(EXPO_ONE_2ND_COLUMN, y, ed->curve, event, attr, isSourceAvailable, MIXSRC_FIRST, INPUTSRC_LAST);
break;

#if defined(FLIGHT_MODES)
Expand Down
6 changes: 3 additions & 3 deletions radio/src/gui/colorlcd/model/input_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void InputEditWindow::buildBody(Window* form)
input->weight = newValue;
preview->update();
SET_DIRTY();
}, INPUTSRC_FIRST);
}, MIXSRC_FIRST);
gvar->setSuffix("%");

// Offset
Expand All @@ -123,7 +123,7 @@ void InputEditWindow::buildBody(Window* form)
input->offset = newValue;
preview->update();
SET_DIRTY();
}, INPUTSRC_FIRST);
}, MIXSRC_FIRST);
gvar->setSuffix("%");

// Switch
Expand All @@ -142,7 +142,7 @@ void InputEditWindow::buildBody(Window* form)
if (preview)
preview->update();
SET_DIRTY();
}, INPUTSRC_FIRST,
}, MIXSRC_FIRST,
[=]() {
if (preview)
preview->update();
Expand Down
6 changes: 3 additions & 3 deletions radio/src/gui/colorlcd/model/mixer_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ void MixEditWindow::buildBody(Window *form)
line = form->newLine(grid);
new StaticText(line, rect_t{}, STR_WEIGHT);
auto svar = new SourceNumberEdit(line, MIX_WEIGHT_MIN, MIX_WEIGHT_MAX,
GET_SET_DEFAULT(mix->weight), 0);
GET_SET_DEFAULT(mix->weight), MIXSRC_FIRST);
svar->setSuffix("%");

// Offset
new StaticText(line, rect_t{}, STR_OFFSET);
auto gvar = new SourceNumberEdit(line, MIX_OFFSET_MIN, MIX_OFFSET_MAX,
GET_SET_DEFAULT(mix->offset), 0);
GET_SET_DEFAULT(mix->offset), MIXSRC_FIRST);
gvar->setSuffix("%");

// Switch
Expand All @@ -127,7 +127,7 @@ void MixEditWindow::buildBody(Window *form)

// Curve
new StaticText(line, rect_t{}, STR_CURVE);
new CurveParam(line, rect_t{}, &mix->curve, SET_DEFAULT(mix->curve.value), 0);
new CurveParam(line, rect_t{}, &mix->curve, SET_DEFAULT(mix->curve.value), MIXSRC_FIRST);

line = form->newLine(grid);
line->padAll(PAD_LARGE);
Expand Down

0 comments on commit 1024717

Please sign in to comment.