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:
Michael
2022-12-23 09:42:58 +10:00
committed by GitHub
parent 21f686ee9b
commit c099a74da4
3 changed files with 12 additions and 11 deletions
+7 -9
View File
@@ -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
}
+2 -1
View File
@@ -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
@@ -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);