Skip to content

Commit

Permalink
color: slightly better layout for FLEX switches
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic committed Aug 5, 2023
1 parent dbe99ac commit 906c62b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions radio/src/gui/colorlcd/hw_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,9 @@ HWPots::HWPots(Window* parent) : FormWindow(parent, rect_t{})
new StaticText(line, rect_t{}, adcGetInputLabel(ADC_INPUT_FLEX, i), 0,
COLOR_THEME_PRIMARY1);

auto box = new FormWindow(line, rect_t{});
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(4));

auto box_obj = box->getLvObj();
lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0);

new HWInputEdit(box, (char*)analogGetCustomLabel(ADC_INPUT_FLEX, i), LEN_ANA_NAME);
new HWInputEdit(line, (char*)analogGetCustomLabel(ADC_INPUT_FLEX, i), LEN_ANA_NAME);
new Choice(
box, rect_t{}, STR_POTTYPES, FLEX_NONE, FLEX_SWITCH,
line, rect_t{}, STR_POTTYPES, FLEX_NONE, FLEX_SWITCH,
[=]() -> int {
return bfGet<potconfig_t>(g_eeGeneral.potsConfig, POT_CFG_BITS * i,
POT_CFG_BITS);
Expand Down Expand Up @@ -155,14 +149,14 @@ HWSwitches::HWSwitches(Window* parent) : FormWindow(parent, rect_t{})
for (int i = 0; i < max_switches; i++) {
auto line = newLine(&grid);
new SwitchDynamicLabel(line, i);
new HWInputEdit(line, (char*)switchGetCustomName(i), LEN_SWITCH_NAME);

auto box = new FormWindow(line, rect_t{});
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(4));

auto box_obj = box->getLvObj();
lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0);

new HWInputEdit(box, (char*)switchGetCustomName(i), LEN_SWITCH_NAME);
if (switchIsFlex(i)) {
auto channel = new Choice(
box, rect_t{}, 0, adcGetMaxInputs(ADC_INPUT_FLEX) - 1,
Expand All @@ -176,7 +170,7 @@ HWSwitches::HWSwitches(Window* parent) : FormWindow(parent, rect_t{})
}

new Choice(
line, rect_t{}, STR_SWTYPES, SWITCH_NONE, switchGetMaxType(i),
box, rect_t{}, STR_SWTYPES, SWITCH_NONE, switchGetMaxType(i),
[=]() -> int { return SWITCH_CONFIG(i); },
[=](int newValue) {
swconfig_t mask = (swconfig_t)SWITCH_CONFIG_MASK(i);
Expand Down

0 comments on commit 906c62b

Please sign in to comment.