Skip to content

Commit

Permalink
fix(color): 6POS display on the main and calib. screens (#2684)
Browse files Browse the repository at this point in the history
* Fix 6POS switch display on the main and calibration screens

* remove unnecessary TRACE()
  • Loading branch information
eshifri authored and pfeerick committed Nov 6, 2022
1 parent f83f9e0 commit 035e761
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion radio/src/gui/colorlcd/layouts/sliders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions radio/src/gui/colorlcd/layouts/sliders.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 035e761

Please sign in to comment.