Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(color): Center flight mode text and 6Pos numbers #2893

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions radio/src/gui/colorlcd/layouts/sliders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,17 @@ MainView6POS::MainView6POS(Window* parent, uint8_t idx) :
void MainView6POS::paint(BitmapBuffer * dc)
{
#if NUM_XPOTS > 0 // prevent compiler warning
// The ticks
int delta = (width() - TRIM_SQUARE_SIZE) / (XPOTS_MULTIPOS_COUNT - 1);
coord_t x = TRIM_SQUARE_SIZE / 2;
for (uint8_t i = 0; i <= XPOTS_MULTIPOS_COUNT; i++) {
dc->drawSolidVerticalLine(x, 4, 9, COLOR_THEME_SECONDARY1);
x += delta;
coord_t x = MULTIPOS_W_SPACING/4;
for (uint8_t value = 0; value < XPOTS_MULTIPOS_COUNT; value++) {
dc->drawNumber(x+TRIM_SQUARE_SIZE/4, 0, value+1, FONT(XS) | COLOR_THEME_SECONDARY1);
x += MULTIPOS_W_SPACING;
}

// The square
value = 1 + (potsPos[idx] & 0x0f);
x = TRIM_SQUARE_SIZE / 2 + divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value -1) , 6);
value = (potsPos[idx] & 0x0f);
x = MULTIPOS_W_SPACING/4+MULTIPOS_W_SPACING*value;
drawTrimSquare(dc, x, 0, COLOR_THEME_FOCUS);
dc->drawNumber(x + 1, 0, value, FONT(XS) | COLOR_THEME_PRIMARY2);
dc->drawNumber(x+MULTIPOS_W_SPACING/4, -2, value+1, FONT(BOLD) | COLOR_THEME_PRIMARY2);
#endif
}

Expand Down
3 changes: 2 additions & 1 deletion radio/src/gui/colorlcd/layouts/sliders.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ constexpr uint8_t SLIDER_TICKS_COUNT = 40;
constexpr coord_t HMARGIN = 5;
constexpr coord_t HORIZONTAL_SLIDERS_WIDTH = SLIDER_TICKS_COUNT * 4 + TRIM_SQUARE_SIZE;
constexpr coord_t MULTIPOS_H = 18;
constexpr coord_t MULTIPOS_W = 50;
constexpr coord_t MULTIPOS_W_SPACING = 12;
constexpr coord_t MULTIPOS_W = (6+1)*MULTIPOS_W_SPACING;
constexpr coord_t VERTICAL_SLIDERS_HEIGHT = SLIDER_TICKS_COUNT * 4 + TRIM_SQUARE_SIZE;

class MainViewSlider : public Window
Expand Down
4 changes: 3 additions & 1 deletion radio/src/gui/colorlcd/view_main_decoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ ViewMainDecoration::ViewMainDecoration(Window* parent) :
w_ml = create_layout_box(parent, LV_ALIGN_LEFT_MID, LV_FLEX_FLOW_ROW_REVERSE);
w_mr = create_layout_box(parent, LV_ALIGN_RIGHT_MID, LV_FLEX_FLOW_ROW);
w_bl = create_layout_box(parent, LV_ALIGN_BOTTOM_LEFT, LV_FLEX_FLOW_COLUMN);
w_bc = create_layout_box(parent, LV_ALIGN_BOTTOM_MID, LV_FLEX_FLOW_COLUMN);
w_br = create_layout_box(parent, LV_ALIGN_BOTTOM_RIGHT, LV_FLEX_FLOW_COLUMN);

w_bc = create_layout_box(parent, LV_ALIGN_BOTTOM_MID, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(w_bc->getLvObj(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_AROUND);

createTrims(w_ml, w_mr, w_bl, w_br);
createFlightMode(w_bc);
createSliders(w_ml, w_mr, w_bl, w_bc, w_br);
Expand Down