Model setup: fixed buttons

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent cdeb01d1bb
commit 3687088b41
2 changed files with 14 additions and 11 deletions
+3 -3
View File
@@ -277,11 +277,11 @@ void ModelSetupPage::build(FormWindow * window)
lv_obj_set_style_pad_all(form->getLvObj(), lv_dpx(8), 0); lv_obj_set_style_pad_all(form->getLvObj(), lv_dpx(8), 0);
new SubScreenButton(form, STR_PREFLIGHT, new SubScreenButton(form, STR_PREFLIGHT,
[]() { new ModulePage(EXTERNAL_MODULE); }); []() { new PreflightChecks(); });
new SubScreenButton(form, STR_TRIMS, new SubScreenButton(form, STR_TRIMS,
[]() { new ModulePage(EXTERNAL_MODULE); }); []() { new TrimsSetup(); });
new SubScreenButton(form, STR_THROTTLE_LABEL, new SubScreenButton(form, STR_THROTTLE_LABEL,
[]() { new ModulePage(EXTERNAL_MODULE); }); []() { new ThrottleParams(); });
} }
#define MAX_SUBSCREEN_BTNS 9 #define MAX_SUBSCREEN_BTNS 9
+11 -8
View File
@@ -46,8 +46,18 @@ TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
body.setFlexLayout(); body.setFlexLayout();
FlexGridLayout grid(line_col_dsc, line_row_dsc, 2); FlexGridLayout grid(line_col_dsc, line_row_dsc, 2);
// Reset trims
auto line = body.newLine();
lv_obj_set_style_pad_all(line->getLvObj(), lv_dpx(8), 0);
auto btn = new TextButton(line, rect_t{}, STR_RESET_BTN, []() -> uint8_t {
resetTrims();
return 0;
});
auto btn_obj = btn->getLvObj();
lv_obj_set_width(btn_obj, lv_pct(100));
// Trim step // Trim step
auto line = body.newLine(&grid); line = body.newLine(&grid);
new StaticText(line, rect_t{}, STR_TRIMINC, 0, new StaticText(line, rect_t{}, STR_TRIMINC, 0,
COLOR_THEME_PRIMARY1); COLOR_THEME_PRIMARY1);
new Choice(line, rect_t{}, STR_VTRIMINC, -2, 2, new Choice(line, rect_t{}, STR_VTRIMINC, -2, 2,
@@ -58,13 +68,6 @@ TrimsSetup::TrimsSetup() : Page(ICON_MODEL_SETUP)
new StaticText(line, rect_t{}, STR_ETRIMS, 0, COLOR_THEME_PRIMARY1); new StaticText(line, rect_t{}, STR_ETRIMS, 0, COLOR_THEME_PRIMARY1);
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_model.extendedTrims)); new CheckBox(line, rect_t{}, GET_SET_DEFAULT(g_model.extendedTrims));
// Reset trims
line = body.newLine(&grid);
new TextButton(line, rect_t{}, STR_RESET_BTN, []() -> uint8_t {
resetTrims();
return 0;
});
// Display trims // Display trims
// TODO: move to "Screen setup" ? // TODO: move to "Screen setup" ?
line = body.newLine(&grid); line = body.newLine(&grid);