Skip to content

Commit 035e761

Browse files
eshifripfeerick
authored andcommitted
fix(color): 6POS display on the main and calib. screens (#2684)
* Fix 6POS switch display on the main and calibration screens * remove unnecessary TRACE()
1 parent f83f9e0 commit 035e761

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

radio/src/gui/colorlcd/layouts/sliders.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,23 @@ void MainView6POS::paint(BitmapBuffer * dc)
9696
}
9797

9898
// The square
99-
auto value = 1 + (potsPos[idx] & 0x0f);
99+
value = 1 + (potsPos[idx] & 0x0f);
100100
x = TRIM_SQUARE_SIZE / 2 + divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value -1) , 6);
101101
drawTrimSquare(dc, x, 0, COLOR_THEME_FOCUS);
102102
dc->drawNumber(x + 1, 0, value, FONT(XS) | COLOR_THEME_PRIMARY2);
103103
#endif
104104
}
105105

106+
void MainView6POS::checkEvents()
107+
{
108+
Window::checkEvents();
109+
int16_t newValue = 1 + (potsPos[idx] & 0x0f);
110+
if (value != newValue) {
111+
value = newValue;
112+
invalidate();
113+
}
114+
}
115+
106116
MainViewVerticalSlider::MainViewVerticalSlider(Window* parent, uint8_t idx) :
107117
MainViewSlider(parent, rect_t{}, idx)
108118
{

radio/src/gui/colorlcd/layouts/sliders.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class MainView6POS : public MainViewSlider
7373
// using MainViewSlider::MainViewSlider;
7474
MainView6POS(Window* parent, uint8_t idx);
7575
void paint(BitmapBuffer * dc) override;
76+
void checkEvents() override;
7677
};
7778

7879
class MainViewVerticalSlider : public MainViewSlider

0 commit comments

Comments
 (0)