From 035e76188ba76517f79b0bf07978c889f624f4d2 Mon Sep 17 00:00:00 2001 From: eshifri <46511024+eshifri@users.noreply.github.com> Date: Sat, 5 Nov 2022 22:56:38 -0700 Subject: [PATCH] fix(color): 6POS display on the main and calib. screens (#2684) * Fix 6POS switch display on the main and calibration screens * remove unnecessary TRACE() --- radio/src/gui/colorlcd/layouts/sliders.cpp | 12 +++++++++++- radio/src/gui/colorlcd/layouts/sliders.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/colorlcd/layouts/sliders.cpp b/radio/src/gui/colorlcd/layouts/sliders.cpp index 8244bc207d5..5daf93b6918 100644 --- a/radio/src/gui/colorlcd/layouts/sliders.cpp +++ b/radio/src/gui/colorlcd/layouts/sliders.cpp @@ -96,13 +96,23 @@ void MainView6POS::paint(BitmapBuffer * dc) } // The square - auto value = 1 + (potsPos[idx] & 0x0f); + value = 1 + (potsPos[idx] & 0x0f); x = TRIM_SQUARE_SIZE / 2 + divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value -1) , 6); drawTrimSquare(dc, x, 0, COLOR_THEME_FOCUS); dc->drawNumber(x + 1, 0, value, FONT(XS) | COLOR_THEME_PRIMARY2); #endif } +void MainView6POS::checkEvents() +{ + Window::checkEvents(); + int16_t newValue = 1 + (potsPos[idx] & 0x0f); + if (value != newValue) { + value = newValue; + invalidate(); + } +} + MainViewVerticalSlider::MainViewVerticalSlider(Window* parent, uint8_t idx) : MainViewSlider(parent, rect_t{}, idx) { diff --git a/radio/src/gui/colorlcd/layouts/sliders.h b/radio/src/gui/colorlcd/layouts/sliders.h index 9d7fedbfd02..0fb0b27d4f7 100644 --- a/radio/src/gui/colorlcd/layouts/sliders.h +++ b/radio/src/gui/colorlcd/layouts/sliders.h @@ -73,6 +73,7 @@ class MainView6POS : public MainViewSlider // using MainViewSlider::MainViewSlider; MainView6POS(Window* parent, uint8_t idx); void paint(BitmapBuffer * dc) override; + void checkEvents() override; }; class MainViewVerticalSlider : public MainViewSlider