Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only display PPM multiplier when PPM is used #5649

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions radio/src/gui/colorlcd/radio/radio_trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,25 @@ void RadioTrainerPage::build(Window* form)
#endif

// Trainer multiplier
auto lbl = new StaticText(line, rect_t{}, STR_MULTIPLIER);
lbl->padRight(PAD_SMALL);
lv_obj_set_grid_cell(lbl->getLvObj(), LV_GRID_ALIGN_END, 0, 2,
LV_GRID_ALIGN_CENTER, 0, 1);

auto multiplier =
new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, -10, 40,
GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
multiplier->setDisplayHandler(
[](int32_t value) { return formatNumberAsString(value + 10, PREC1); });
lv_obj_set_grid_cell(multiplier->getLvObj(), LV_GRID_ALIGN_START, 2, 1,
LV_GRID_ALIGN_CENTER, 0, 1);
if (g_model.trainerData.mode == TRAINER_MODE_MASTER_TRAINER_JACK) {
auto lbl = new StaticText(line, rect_t{}, STR_MULTIPLIER);
lbl->padRight(PAD_SMALL);
lv_obj_set_grid_cell(lbl->getLvObj(), LV_GRID_ALIGN_END, 0, 2,
LV_GRID_ALIGN_CENTER, 0, 1);

auto multiplier =
new NumberEdit(line, rect_t{0, 0, NUM_EDIT_W, 0}, -10, 40,
GET_SET_DEFAULT(g_eeGeneral.PPM_Multiplier));
multiplier->setDisplayHandler(
[](int32_t value) { return formatNumberAsString(value + 10, PREC1); });
lv_obj_set_grid_cell(multiplier->getLvObj(), LV_GRID_ALIGN_START, 2, 1,
LV_GRID_ALIGN_CENTER, 0, 1);

#if PORTRAIT_LCD
line = form->newLine(grid);
line->padTop(10);
line = form->newLine(grid);
line->padTop(10);
#endif
}

// Trainer calibration
auto btn = new TextButton(line, rect_t{}, std::string(STR_CALIBRATION),
Expand Down
8 changes: 5 additions & 3 deletions radio/src/gui/common/stdlcd/radio_trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ void menuRadioTrainer(event_t event)
}

attr = (menuVerticalPosition==HEADER_LINE+4) ? blink : 0;
lcdDrawTextAlignedLeft(y, STR_MULTIPLIER);
lcdDrawNumber(LEN_MULTIPLIER*FW+3*FW, y, g_eeGeneral.PPM_Multiplier+10, attr|PREC1|RIGHT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
if (g_model.trainerData.mode == TRAINER_MODE_MASTER_TRAINER_JACK) {
lcdDrawTextAlignedLeft(y, STR_MULTIPLIER);
lcdDrawNumber(LEN_MULTIPLIER * FW + 3 * FW, y, g_eeGeneral.PPM_Multiplier + 10, attr | PREC1 | RIGHT);
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
}
y += FH;

attr = (menuVerticalPosition==HEADER_LINE+5) ? INVERS : 0;
Expand Down