fix(color): Center flight mode text and 6Pos numbers (#2893)
* centers flight mode text, 6Pos indicator and 6Pos numbers in square replaces ticks with numbers in 6Pos indicator * stole @philmoz idea to bold the selected switch position to make it stand out more
This commit is contained in:
@@ -87,19 +87,17 @@ MainView6POS::MainView6POS(Window* parent, uint8_t idx) :
|
|||||||
void MainView6POS::paint(BitmapBuffer * dc)
|
void MainView6POS::paint(BitmapBuffer * dc)
|
||||||
{
|
{
|
||||||
#if NUM_XPOTS > 0 // prevent compiler warning
|
#if NUM_XPOTS > 0 // prevent compiler warning
|
||||||
// The ticks
|
coord_t x = MULTIPOS_W_SPACING/4;
|
||||||
int delta = (width() - TRIM_SQUARE_SIZE) / (XPOTS_MULTIPOS_COUNT - 1);
|
for (uint8_t value = 0; value < XPOTS_MULTIPOS_COUNT; value++) {
|
||||||
coord_t x = TRIM_SQUARE_SIZE / 2;
|
dc->drawNumber(x+TRIM_SQUARE_SIZE/4, 0, value+1, FONT(XS) | COLOR_THEME_SECONDARY1);
|
||||||
for (uint8_t i = 0; i <= XPOTS_MULTIPOS_COUNT; i++) {
|
x += MULTIPOS_W_SPACING;
|
||||||
dc->drawSolidVerticalLine(x, 4, 9, COLOR_THEME_SECONDARY1);
|
|
||||||
x += delta;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The square
|
// The square
|
||||||
value = 1 + (potsPos[idx] & 0x0f);
|
value = (potsPos[idx] & 0x0f);
|
||||||
x = TRIM_SQUARE_SIZE / 2 + divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value -1) , 6);
|
x = MULTIPOS_W_SPACING/4+MULTIPOS_W_SPACING*value;
|
||||||
drawTrimSquare(dc, x, 0, COLOR_THEME_FOCUS);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ constexpr uint8_t SLIDER_TICKS_COUNT = 40;
|
|||||||
constexpr coord_t HMARGIN = 5;
|
constexpr coord_t HMARGIN = 5;
|
||||||
constexpr coord_t HORIZONTAL_SLIDERS_WIDTH = SLIDER_TICKS_COUNT * 4 + TRIM_SQUARE_SIZE;
|
constexpr coord_t HORIZONTAL_SLIDERS_WIDTH = SLIDER_TICKS_COUNT * 4 + TRIM_SQUARE_SIZE;
|
||||||
constexpr coord_t MULTIPOS_H = 18;
|
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;
|
constexpr coord_t VERTICAL_SLIDERS_HEIGHT = SLIDER_TICKS_COUNT * 4 + TRIM_SQUARE_SIZE;
|
||||||
|
|
||||||
class MainViewSlider : public Window
|
class MainViewSlider : public Window
|
||||||
|
|||||||
@@ -60,9 +60,11 @@ ViewMainDecoration::ViewMainDecoration(Window* parent) :
|
|||||||
w_ml = create_layout_box(parent, LV_ALIGN_LEFT_MID, LV_FLEX_FLOW_ROW_REVERSE);
|
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_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_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_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);
|
createTrims(w_ml, w_mr, w_bl, w_br);
|
||||||
createFlightMode(w_bc);
|
createFlightMode(w_bc);
|
||||||
createSliders(w_ml, w_mr, w_bl, w_bc, w_br);
|
createSliders(w_ml, w_mr, w_bl, w_bc, w_br);
|
||||||
|
|||||||
Reference in New Issue
Block a user