diff --git a/radio/src/gui/colorlcd/layout.cpp b/radio/src/gui/colorlcd/layout.cpp index c0acde330..a84c397ca 100644 --- a/radio/src/gui/colorlcd/layout.cpp +++ b/radio/src/gui/colorlcd/layout.cpp @@ -270,5 +270,11 @@ rect_t Layout::getMainZone(rect_t zone) const zone.x += TRIM_SQUARE_SIZE; } + if (zone.w % 2 != 0) + zone.w -= 1; + + if (zone.h % 2 != 0) + zone.h -= 1; + return zone; } diff --git a/radio/src/gui/colorlcd/layouts/layout2+1.cpp b/radio/src/gui/colorlcd/layouts/layout2+1.cpp index 989775d71..e99b09291 100644 --- a/radio/src/gui/colorlcd/layouts/layout2+1.cpp +++ b/radio/src/gui/colorlcd/layouts/layout2+1.cpp @@ -28,6 +28,8 @@ #define HAS_TRIMS() (persistentData->options[3].value.boolValue == true) #define IS_MIRRORED() (persistentData->options[4].value.boolValue == true) +constexpr coord_t border = 10; + const uint8_t LBM_LAYOUT_2P1[] = { #include "mask_layout2+1.lbm" }; @@ -37,12 +39,6 @@ const ZoneOption OPTIONS_LAYOUT_2P1[] = { LAYOUT_OPTIONS_END }; -const rect_t ZONES_LAYOUT_2P1[3] = { - { 240, 60, 192, 152 }, - { 48, 60, 180, 70 }, - { 48, 142, 180, 70 } -}; - class Layout2P1: public Layout { public: @@ -65,12 +61,27 @@ class Layout2P1: public Layout unsigned int getZonesCount() const override { - return DIM(ZONES_LAYOUT_2P1); + return 3; } rect_t getZone(unsigned int index) const override { - return ZONES_LAYOUT_2P1[index]; + if (IS_MIRRORED()) + index = 2 - index; + + rect_t zone = getMainZone({border, border, LCD_W - 2 * border, LCD_H - 2 * border}); + + if (index == 0) { + return {zone.x, zone.y,zone.w / 2, zone.h}; + } + else if (index == 1) { + return {zone.x + zone.w / 2, zone.y,zone.w / 2, zone.h / 2}; + } + else { + return {zone.x + zone.w / 2, zone.y + zone.h / 2,zone.w / 2, zone.h / 2}; + } + + return zone; } };