From 40ae2e22a8329e2122c7a97e7fd8e7f1548abea9 Mon Sep 17 00:00:00 2001 From: Malte Langermann <54738901+gagarinlg@users.noreply.github.com> Date: Sun, 9 Oct 2022 07:59:19 +0200 Subject: [PATCH] fix(gui): add missing channel IDs to mixer and output tabs. (#2464) * fix(gui): add missing channel IDs to mixer and output tabs. Fixes #2073 * fix: input display and more space for names * made output names fit on all display variants * channe id display fine tuning * Outputs with no name are bigger ... magnifying glass was not included with tx ;) Co-authored-by: Raphael Coeffic Co-authored-by: Peter Feerick --- radio/src/gui/colorlcd/channel_bar.h | 2 +- radio/src/gui/colorlcd/input_mix_group.cpp | 23 +++++++++++++++++-- radio/src/gui/colorlcd/model_outputs.cpp | 26 +++++++++++++++++----- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/radio/src/gui/colorlcd/channel_bar.h b/radio/src/gui/colorlcd/channel_bar.h index f013c2b7c..c67346b61 100644 --- a/radio/src/gui/colorlcd/channel_bar.h +++ b/radio/src/gui/colorlcd/channel_bar.h @@ -116,7 +116,7 @@ class ComboChannelBar : public Window void paint(BitmapBuffer * dc) override { - char chanString[] = "CH32 "; + char chanString[] = TR_CH"32 "; int usValue = PPM_CH_CENTER(channel) + channelOutputs[channel] / 2; // Channel number diff --git a/radio/src/gui/colorlcd/input_mix_group.cpp b/radio/src/gui/colorlcd/input_mix_group.cpp index 3acc934b0..99fa378c0 100644 --- a/radio/src/gui/colorlcd/input_mix_group.cpp +++ b/radio/src/gui/colorlcd/input_mix_group.cpp @@ -29,7 +29,7 @@ #include static const lv_coord_t col_dsc[] = { - LV_DPI_DEF / 2, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST, + lv_coord_t(LV_DPI_DEF * 0.65), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST, }; static const lv_coord_t row_dsc[] = { @@ -53,11 +53,30 @@ InputMixGroup::InputMixGroup(Window* parent, mixsrc_t idx) : lv_obj_add_event_cb(lvobj, InputMixGroup::value_changed, LV_EVENT_VALUE_CHANGED, nullptr); + lv_obj_t* chText = nullptr; + if (idx >= MIXSRC_FIRST_CH && idx <= MIXSRC_LAST_CH + && g_model.limitData[idx - MIXSRC_CH1].name[0] != '\0') { + chText = lv_label_create(lvobj); + lv_label_set_text_fmt(chText, TR_CH "%u", idx - MIXSRC_CH1 + 1); + lv_obj_set_style_text_font(chText, getFont(FONT(XS)), 0); +#if LCD_H > LCD_W + lv_obj_set_style_pad_bottom(chText, -2, 0); +#endif + lv_obj_set_grid_cell(chText, + LV_GRID_ALIGN_START, 0, 1, + LV_GRID_ALIGN_END, 0, 1); + } + label = lv_label_create(lvobj); + lv_obj_set_style_text_font(label, getFont(FONT(STD)), 0); +#if LCD_H > LCD_W + if(chText) + lv_obj_set_style_pad_top(label, -1, 0); +#endif lv_label_set_text(label, getSourceString(idx)); lv_obj_set_grid_cell(label, LV_GRID_ALIGN_START, 0, 1, - LV_GRID_ALIGN_START, 0, 1); + chText?LV_GRID_ALIGN_START:LV_GRID_ALIGN_CENTER, 0, 1); auto box = window_create(lvobj); lv_obj_set_size(box, lv_pct(100), LV_SIZE_CONTENT); diff --git a/radio/src/gui/colorlcd/model_outputs.cpp b/radio/src/gui/colorlcd/model_outputs.cpp index 74c6b8930..bb314544b 100644 --- a/radio/src/gui/colorlcd/model_outputs.cpp +++ b/radio/src/gui/colorlcd/model_outputs.cpp @@ -153,9 +153,16 @@ class OutputLineButton : public ListLineButton lv_obj_set_grid_dsc_array(lvobj, col_dsc, row_dsc); source = lv_label_create(lvobj); - lv_obj_set_style_text_font(source, getFont(FONT(BOLD)), 0); + +#if LCD_H > LCD_W lv_obj_set_grid_cell(source, LV_GRID_ALIGN_START, 0, 1, - LV_GRID_ALIGN_START, 0, 1); + LV_GRID_ALIGN_CENTER, 0, 2); + +#else + lv_obj_set_style_text_font(source, getFont(FONT(XS)), 0); + lv_obj_set_grid_cell(source, LV_GRID_ALIGN_START, 0, 1, + LV_GRID_ALIGN_CENTER, 0, 1); +#endif lv_obj_add_event_cb(lvobj, OutputLineButton::on_draw, LV_EVENT_DRAW_MAIN, nullptr); } @@ -165,9 +172,18 @@ class OutputLineButton : public ListLineButton if (!init) return; const LimitData* output = limitAddress(index); - - lv_label_set_text(source, getSourceString(MIXSRC_CH1 + index)); - + if(g_model.limitData[index].name[0] != '\0') + { +#if LCD_W > LCD_H + lv_obj_set_style_text_line_space(source, -3, LV_PART_MAIN); + lv_obj_set_style_pad_top(source, -7, 0); + lv_obj_set_style_pad_bottom(source, -7, 0); +#endif + lv_label_set_text_fmt(source, "%s\n" TR_CH "%u", getSourceString(MIXSRC_CH1 + index), index + 1); + } else { + lv_obj_set_style_text_font(source, getFont(FONT(STD)), 0); + lv_label_set_text(source, getSourceString(MIXSRC_CH1 + index)); + } if (output->revert) { lv_obj_clear_flag(revert, LV_OBJ_FLAG_HIDDEN); } else {