diff --git a/radio/src/gui/colorlcd/model_inputs.cpp b/radio/src/gui/colorlcd/model_inputs.cpp index 8ffb43de056..ea7f6e69661 100644 --- a/radio/src/gui/colorlcd/model_inputs.cpp +++ b/radio/src/gui/colorlcd/model_inputs.cpp @@ -447,9 +447,18 @@ void ModelInputsPage::build(FormWindow *window) form = new FormWindow(window, rect_t{}); form->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3); + auto btn = new TextButton(window, rect_t{}, LV_SYMBOL_PLUS, [=]() { + newInput(); + return 0; + }); + auto btn_obj = btn->getLvObj(); + lv_obj_set_width(btn_obj, lv_pct(100)); + lv_group_focus_obj(btn_obj); + groups.clear(); lines.clear(); + bool focusSet = false; uint8_t index = 0; ExpoData* line = g_model.expoData; for (uint8_t input = 0; input < MAX_INPUTS; input++) { @@ -462,7 +471,11 @@ void ModelInputsPage::build(FormWindow *window) groups.emplace_back(group); while (index < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) { // one button per input line - createLineButton(group, index); + auto btn = createLineButton(group, index); + if (!focusSet) { + focusSet = true; + lv_group_focus_obj(btn->getLvObj()); + } ++index; ++line; } @@ -473,12 +486,5 @@ void ModelInputsPage::build(FormWindow *window) break; } } - - auto btn = new TextButton(window, rect_t{}, LV_SYMBOL_PLUS, [=]() { - newInput(); - return 0; - }); - auto btn_obj = btn->getLvObj(); - lv_obj_set_width(btn_obj, lv_pct(100)); } diff --git a/radio/src/gui/colorlcd/model_mixes.cpp b/radio/src/gui/colorlcd/model_mixes.cpp index 7eae302f299..ce2202374a5 100644 --- a/radio/src/gui/colorlcd/model_mixes.cpp +++ b/radio/src/gui/colorlcd/model_mixes.cpp @@ -409,9 +409,31 @@ void ModelMixesPage::build(FormWindow * window) form = new FormWindow(window, rect_t{}); form->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3); + auto box = new FormWindow(window, rect_t{}); + box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); + box->padLeft(lv_dpx(8)); + + auto box_obj = box->getLvObj(); + lv_obj_set_width(box_obj, lv_pct(100)); + lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0); + + new StaticText(box, rect_t{}, STR_SHOW_MIXER_MONITORS, 0, COLOR_THEME_PRIMARY1); + new CheckBox( + box, rect_t{}, [=]() { return showMonitors; }, + [=](uint8_t val) { enableMonitors(val); }); + + auto btn = new TextButton(window, rect_t{}, LV_SYMBOL_PLUS, [=]() { + newMix(); + return 0; + }); + auto btn_obj = btn->getLvObj(); + lv_obj_set_width(btn_obj, lv_pct(100)); + lv_group_focus_obj(btn_obj); + groups.clear(); lines.clear(); + bool focusSet = false; uint8_t index = 0; MixData* line = g_model.mixData; for (uint8_t ch = 0; (ch < MAX_OUTPUT_CHANNELS) && (index < MAX_MIXERS); ch++) { @@ -423,32 +445,16 @@ void ModelMixesPage::build(FormWindow * window) groups.emplace_back(group); while (index < MAX_MIXERS && (line->destCh == ch)) { // one button per input line - createLineButton(group, index); + auto btn = createLineButton(group, index); + if (!focusSet) { + focusSet = true; + lv_group_focus_obj(btn->getLvObj()); + } ++index; ++line; } } } - - auto box = new FormGroup(window, rect_t{}); - box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); - box->padLeft(lv_dpx(8)); - - auto box_obj = box->getLvObj(); - lv_obj_set_width(box_obj, lv_pct(100)); - lv_obj_set_style_flex_cross_place(box_obj, LV_FLEX_ALIGN_CENTER, 0); - - new StaticText(box, rect_t{}, STR_SHOW_MIXER_MONITORS, 0, COLOR_THEME_PRIMARY1); - new CheckBox( - box, rect_t{}, [=]() { return showMonitors; }, - [=](uint8_t val) { enableMonitors(val); }); - - auto btn = new TextButton(window, rect_t{}, LV_SYMBOL_PLUS, [=]() { - newMix(); - return 0; - }); - auto btn_obj = btn->getLvObj(); - lv_obj_set_width(btn_obj, lv_pct(100)); } void ModelMixesPage::enableMonitors(bool enabled)