diff --git a/radio/src/gui/colorlcd/model_inputs.cpp b/radio/src/gui/colorlcd/model_inputs.cpp index 833aaf22e..3e42c4dd2 100644 --- a/radio/src/gui/colorlcd/model_inputs.cpp +++ b/radio/src/gui/colorlcd/model_inputs.cpp @@ -454,9 +454,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++) { @@ -469,7 +478,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; } @@ -480,12 +493,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 b05a83422..b8558f23f 100644 --- a/radio/src/gui/colorlcd/model_mixes.cpp +++ b/radio/src/gui/colorlcd/model_mixes.cpp @@ -523,32 +523,7 @@ void ModelMixesPage::build(FormWindow * window) form = new FormWindow(window, rect_t{}); form->setFlexLayout(LV_FLEX_FLOW_COLUMN, 3); - groups.clear(); - lines.clear(); - - uint8_t index = 0; - MixData* line = g_model.mixData; - for (uint8_t ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) { - - if (index >= MAX_MIXERS) break; - - bool skip_mix = (ch == 0 && is_memclear(line, sizeof(MixData))); - if (line->destCh == ch && !skip_mix) { - - // one group for the complete mixer channel - auto group = createGroup(form, MIXSRC_FIRST_CH + ch); - groups.emplace_back(group); - while (index < MAX_MIXERS && (line->destCh == ch) && !skip_mix) { - // one button per input line - createLineButton(group, index); - ++index; - ++line; - skip_mix = (ch == 0 && is_memclear(line, sizeof(MixData))); - } - } - } - - auto box = new FormGroup(window, rect_t{}); + auto box = new FormWindow(window, rect_t{}); box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8)); box->padLeft(lv_dpx(8)); @@ -567,6 +542,37 @@ void ModelMixesPage::build(FormWindow * window) }); 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; ch++) { + + if (index >= MAX_MIXERS) break; + + bool skip_mix = (ch == 0 && is_memclear(line, sizeof(MixData))); + if (line->destCh == ch && !skip_mix) { + + // one group for the complete mixer channel + auto group = createGroup(form, MIXSRC_FIRST_CH + ch); + groups.emplace_back(group); + while (index < MAX_MIXERS && (line->destCh == ch) && !skip_mix) { + // one button per input line + auto btn = createLineButton(group, index); + if (!focusSet) { + focusSet = true; + lv_group_focus_obj(btn->getLvObj()); + } + ++index; + ++line; + skip_mix = (ch == 0 && is_memclear(line, sizeof(MixData))); + } + } + } } void ModelMixesPage::enableMonitors(bool enabled)