Model setup: fix button sizes & timer setup scrolling
This commit is contained in:
@@ -254,11 +254,17 @@ void ModelSetupPage::build(FormWindow * window)
|
|||||||
// Modules
|
// Modules
|
||||||
auto form = new FormGroup(window, rect_t{});
|
auto form = new FormGroup(window, rect_t{});
|
||||||
form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8));
|
form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8));
|
||||||
lv_obj_set_style_pad_all(form->getLvObj(), lv_dpx(8), 0);
|
lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0);
|
||||||
|
form->padAll(lv_dpx(8));
|
||||||
|
|
||||||
new IntmoduleButton(form);
|
Window* btn = new IntmoduleButton(form);
|
||||||
new ExtmoduleButton(form);
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
new TrainerModuleButton(form);
|
|
||||||
|
btn = new ExtmoduleButton(form);
|
||||||
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
|
|
||||||
|
btn = new TrainerModuleButton(form);
|
||||||
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
|
|
||||||
// Timer buttons
|
// Timer buttons
|
||||||
form = new FormGroup(window, rect_t{});
|
form = new FormGroup(window, rect_t{});
|
||||||
@@ -266,24 +272,35 @@ void ModelSetupPage::build(FormWindow * window)
|
|||||||
lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0);
|
lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0);
|
||||||
form->padAll(lv_dpx(8));
|
form->padAll(lv_dpx(8));
|
||||||
|
|
||||||
new SubScreenButton(form, TR_TIMER "1",
|
btn = new SubScreenButton(form, TR_TIMER "1",
|
||||||
[]() { new TimerWindow(0); });
|
[]() { new TimerWindow(0); });
|
||||||
new SubScreenButton(form, TR_TIMER "2",
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
[]() { new TimerWindow(1); });
|
|
||||||
new SubScreenButton(form, TR_TIMER "3",
|
btn = new SubScreenButton(form, TR_TIMER "2",
|
||||||
[]() { new TimerWindow(2); });
|
[]() { new TimerWindow(1); });
|
||||||
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
|
|
||||||
|
btn = new SubScreenButton(form, TR_TIMER "3",
|
||||||
|
[]() { new TimerWindow(2); });
|
||||||
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
|
|
||||||
|
|
||||||
form = new FormGroup(window, rect_t{});
|
form = new FormGroup(window, rect_t{});
|
||||||
form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8));
|
form->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, lv_dpx(8));
|
||||||
lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0);
|
lv_obj_set_style_flex_main_place(form->getLvObj(), LV_FLEX_ALIGN_SPACE_EVENLY, 0);
|
||||||
form->padAll(lv_dpx(8));
|
form->padAll(lv_dpx(8));
|
||||||
|
|
||||||
new SubScreenButton(form, STR_PREFLIGHT,
|
btn = new SubScreenButton(form, STR_PREFLIGHT,
|
||||||
[]() { new PreflightChecks(); });
|
[]() { new PreflightChecks(); });
|
||||||
new SubScreenButton(form, STR_TRIMS,
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
[]() { new TrimsSetup(); });
|
|
||||||
new SubScreenButton(form, STR_THROTTLE_LABEL,
|
btn = new SubScreenButton(form, STR_TRIMS,
|
||||||
[]() { new ThrottleParams(); });
|
[]() { new TrimsSetup(); });
|
||||||
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
|
|
||||||
|
btn = new SubScreenButton(form, STR_THROTTLE_LABEL,
|
||||||
|
[]() { new ThrottleParams(); });
|
||||||
|
lv_obj_set_style_min_width(btn->getLvObj(), LV_DPI_DEF, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_SUBSCREEN_BTNS 9
|
#define MAX_SUBSCREEN_BTNS 9
|
||||||
|
|||||||
@@ -99,13 +99,9 @@ private:
|
|||||||
|
|
||||||
PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
PreflightChecks::PreflightChecks() : Page(ICON_MODEL_SETUP)
|
||||||
{
|
{
|
||||||
new StaticText(&header,
|
header.setTitle(STR_PREFLIGHT);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
STR_PREFLIGHT, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
auto form = new FormWindow(&body, rect_t{0, 0, body.width(), body.height()},
|
auto form = new FormWindow(&body, rect_t{});
|
||||||
NO_FOCUS | FORM_FORWARD_FOCUS);
|
|
||||||
form->setFlexLayout();
|
form->setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
||||||
|
|
||||||
|
|||||||
@@ -46,61 +46,58 @@ static std::function<void(uint32_t)> timerValueUpdater(uint8_t timer)
|
|||||||
TimerWindow::TimerWindow(uint8_t timer) : Page(ICON_STATS_TIMERS)
|
TimerWindow::TimerWindow(uint8_t timer) : Page(ICON_STATS_TIMERS)
|
||||||
{
|
{
|
||||||
std::string title = std::string(STR_TIMER) + std::to_string(timer + 1);
|
std::string title = std::string(STR_TIMER) + std::to_string(timer + 1);
|
||||||
new StaticText(&header,
|
header.setTitle(title);
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
|
||||||
PAGE_LINE_HEIGHT},
|
|
||||||
title, 0, COLOR_THEME_PRIMARY2);
|
|
||||||
|
|
||||||
body.setFlexLayout();
|
auto form = new FormGroup(&body, rect_t{});
|
||||||
|
form->setFlexLayout();
|
||||||
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
|
||||||
|
|
||||||
TimerData* p_timer = &g_model.timers[timer];
|
TimerData* p_timer = &g_model.timers[timer];
|
||||||
|
|
||||||
// Timer name
|
// Timer name
|
||||||
auto line = body.newLine(&grid);
|
auto line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_NAME, 0, COLOR_THEME_PRIMARY1);
|
||||||
new ModelTextEdit(line, rect_t{}, p_timer->name, LEN_TIMER_NAME);
|
new ModelTextEdit(line, rect_t{}, p_timer->name, LEN_TIMER_NAME);
|
||||||
|
|
||||||
// Timer mode
|
// Timer mode
|
||||||
line = body.newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_MODE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_MODE, 0, COLOR_THEME_PRIMARY1);
|
||||||
new Choice(line, rect_t{}, STR_TIMER_MODES, 0, TMRMODE_MAX,
|
new Choice(line, rect_t{}, STR_TIMER_MODES, 0, TMRMODE_MAX,
|
||||||
GET_SET_DEFAULT(p_timer->mode));
|
GET_SET_DEFAULT(p_timer->mode));
|
||||||
|
|
||||||
// Timer switch
|
// Timer switch
|
||||||
line = body.newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_SWITCH, 0, COLOR_THEME_PRIMARY1);
|
||||||
new SwitchChoice(line, rect_t{}, SWSRC_FIRST, SWSRC_LAST,
|
new SwitchChoice(line, rect_t{}, SWSRC_FIRST, SWSRC_LAST,
|
||||||
GET_SET_DEFAULT(p_timer->swtch));
|
GET_SET_DEFAULT(p_timer->swtch));
|
||||||
|
|
||||||
// Timer start value
|
// Timer start value
|
||||||
line = body.newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_START, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_START, 0, COLOR_THEME_PRIMARY1);
|
||||||
new TimeEdit(line, rect_t{}, 0, TIMER_MAX, GET_DEFAULT(p_timer->start),
|
new TimeEdit(line, rect_t{}, 0, TIMER_MAX, GET_DEFAULT(p_timer->start),
|
||||||
timerValueUpdater(timer));
|
timerValueUpdater(timer));
|
||||||
|
|
||||||
// Timer minute beep
|
// Timer minute beep
|
||||||
line = body.newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_MINUTEBEEP, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_MINUTEBEEP, 0, COLOR_THEME_PRIMARY1);
|
||||||
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(p_timer->minuteBeep));
|
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(p_timer->minuteBeep));
|
||||||
|
|
||||||
// Timer countdown
|
// Timer countdown
|
||||||
line = body.newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_BEEPCOUNTDOWN, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_BEEPCOUNTDOWN, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
auto box = new FormGroup::Line(line, window_create(line->getLvObj()));
|
auto box = new FormGroup(line, rect_t{});
|
||||||
lv_obj_set_layout(box->getLvObj(), LV_LAYOUT_FLEX);
|
box->setFlexLayout(LV_FLEX_FLOW_ROW);
|
||||||
|
|
||||||
new Choice(box, rect_t{}, STR_VBEEPCOUNTDOWN, COUNTDOWN_SILENT,
|
new Choice(box, rect_t{}, STR_VBEEPCOUNTDOWN, COUNTDOWN_SILENT,
|
||||||
COUNTDOWN_COUNT - 1, GET_SET_DEFAULT(p_timer->countdownBeep));
|
COUNTDOWN_COUNT - 1, GET_SET_DEFAULT(p_timer->countdownBeep));
|
||||||
new Choice(box, rect_t{}, STR_COUNTDOWNVALUES, 0, 3,
|
new Choice(box, rect_t{}, STR_COUNTDOWNVALUES, 0, 3,
|
||||||
GET_SET_WITH_OFFSET(p_timer->countdownStart, 2));
|
GET_SET_WITH_OFFSET(p_timer->countdownStart, 2));
|
||||||
|
|
||||||
// Timer persistent
|
// Timer persistent
|
||||||
line = body.newLine(&grid);
|
line = form->newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_PERSISTENT, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_PERSISTENT, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
new Choice(line, rect_t{}, STR_VPERSISTENT, 0, 2,
|
new Choice(line, rect_t{}, STR_VPERSISTENT, 0, 2,
|
||||||
GET_SET_DEFAULT(p_timer->persistent));
|
GET_SET_DEFAULT(p_timer->persistent));
|
||||||
|
|
||||||
body.updateSize();
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user