Skip to content

Commit

Permalink
chore(color): Change STR_CAL to STR_CALIBRATION on trainer page (Edge…
Browse files Browse the repository at this point in the history
…TX#4408)

Co-authored-by: philmoz <[email protected]>
  • Loading branch information
pfeerick and philmoz authored Dec 12, 2023
1 parent e4dd546 commit 29cce09
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions radio/src/gui/colorlcd/radio_trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ RadioTrainerPage::RadioTrainerPage():
static const lv_coord_t col_dsc[] = {LV_GRID_FR(7), LV_GRID_FR(13), LV_GRID_FR(10), LV_GRID_FR(10), LV_GRID_FR(10),
LV_GRID_TEMPLATE_LAST};

#define MULT_COL_CNT 3
#define NUM_EDIT_W 80
#else
static const lv_coord_t col_dsc[] = {LV_GRID_FR(7), LV_GRID_FR(15), LV_GRID_FR(9), LV_GRID_FR(9),
LV_GRID_TEMPLATE_LAST};
#define MULT_COL_CNT 2
#define NUM_EDIT_W 65
#endif

Expand Down Expand Up @@ -98,24 +96,29 @@ void RadioTrainerPage::build(FormWindow * form)
// Trainer multiplier
auto lbl = new StaticText(line, rect_t{}, STR_MULTIPLIER, 0, COLOR_THEME_PRIMARY1);
lbl->padRight(4);
lv_obj_set_grid_cell(lbl->getLvObj(), LV_GRID_ALIGN_END, 0, MULT_COL_CNT, LV_GRID_ALIGN_CENTER, 0, 1);
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, MULT_COL_CNT, 1, LV_GRID_ALIGN_CENTER, 0, 1);
lv_obj_set_grid_cell(multiplier->getLvObj(), LV_GRID_ALIGN_START, 2, 1, LV_GRID_ALIGN_CENTER, 0, 1);

#if LCD_H > LCD_W
line = form->newLine(&grid);
line->padTop(10);
#endif

// Trainer calibration
auto btn = new TextButton(line, rect_t{0, 0, 0, 30}, std::string(STR_CAL), [=]() -> uint8_t {
auto btn = new TextButton(line, rect_t{}, std::string(STR_CALIBRATION), [=]() -> uint8_t {
memcpy(g_eeGeneral.trainer.calib, trainerInput,
sizeof(g_eeGeneral.trainer.calib));
SET_DIRTY();
return 0;
});
lv_obj_set_grid_cell(btn->getLvObj(), LV_GRID_ALIGN_STRETCH, MULT_COL_CNT+1, 1, LV_GRID_ALIGN_CENTER, 0, 1);
#if LCD_H > LCD_W
lv_obj_set_grid_cell(btn->getLvObj(), LV_GRID_ALIGN_STRETCH, 1, 2, LV_GRID_ALIGN_CENTER, 0, 1);
#else
lv_obj_set_grid_cell(btn->getLvObj(), LV_GRID_ALIGN_START, 3, 2, LV_GRID_ALIGN_CENTER, 0, 1);
#endif
}

0 comments on commit 29cce09

Please sign in to comment.