mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Remove the scroll indicator when scrolling menu
This commit is contained in:
@@ -211,6 +211,36 @@ void OLED::drawScrollIndicator(uint8_t y, uint8_t height) {
|
|||||||
fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]);
|
fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Masks (removes) the scrolling indicator, i.e. clears the rightmost column
|
||||||
|
* on the screen. This operates directly on the OLED graphics RAM, as this
|
||||||
|
* is intended to be used before calling `OLED::transitionScrollDown()`.
|
||||||
|
*/
|
||||||
|
void OLED::maskScrollIndicatorOnOLED() {
|
||||||
|
// The right-most column depends on the screen rotation, so just take
|
||||||
|
// it from the screen buffer which is updated by `OLED::setRotation`.
|
||||||
|
uint8_t rightmostColumn = screenBuffer[7];
|
||||||
|
uint8_t maskCommands[] = {
|
||||||
|
// Set column address:
|
||||||
|
// A[6:0] - Column start address = rightmost column
|
||||||
|
// B[6:0] - Column end address = rightmost column
|
||||||
|
0x80,
|
||||||
|
0x21, // cmd
|
||||||
|
0x80,
|
||||||
|
rightmostColumn, // A
|
||||||
|
0x80,
|
||||||
|
rightmostColumn, // B
|
||||||
|
|
||||||
|
// Start of data
|
||||||
|
0x40,
|
||||||
|
|
||||||
|
// Clears two 8px strips
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
FRToSI2C::Transmit(DEVICEADDR_OLED, maskCommands, sizeof(maskCommands));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays a transition animation between two framebuffers.
|
* Plays a transition animation between two framebuffers.
|
||||||
* @param forwardNavigation Direction of the navigation animation.
|
* @param forwardNavigation Direction of the navigation animation.
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public:
|
|||||||
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool clear);
|
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool clear);
|
||||||
static void drawHeatSymbol(uint8_t state);
|
static void drawHeatSymbol(uint8_t state);
|
||||||
static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator
|
static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator
|
||||||
|
static void maskScrollIndicatorOnOLED();
|
||||||
static void transitionSecondaryFramebuffer(bool forwardNavigation);
|
static void transitionSecondaryFramebuffer(bool forwardNavigation);
|
||||||
static void useSecondaryFramebuffer(bool useSecondary);
|
static void useSecondaryFramebuffer(bool useSecondary);
|
||||||
static void transitionScrollDown();
|
static void transitionScrollDown();
|
||||||
|
|||||||
@@ -1086,7 +1086,7 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
uint8_t position = OLED_HEIGHT * currentScreen / scrollContentSize;
|
uint8_t position = OLED_HEIGHT * currentScreen / scrollContentSize;
|
||||||
if (lastValue)
|
if (lastValue)
|
||||||
scrollBlink = !scrollBlink;
|
scrollBlink = !scrollBlink;
|
||||||
if (!lastValue || !scrollBlink)
|
if ((!lastValue || !scrollBlink) && !scrollingDown)
|
||||||
OLED::drawScrollIndicator(position, indicatorHeight);
|
OLED::drawScrollIndicator(position, indicatorHeight);
|
||||||
} else {
|
} else {
|
||||||
// Draw description
|
// Draw description
|
||||||
@@ -1096,6 +1096,7 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
|
|
||||||
if (lcdRefresh) {
|
if (lcdRefresh) {
|
||||||
if (scrollingDown) {
|
if (scrollingDown) {
|
||||||
|
OLED::maskScrollIndicatorOnOLED();
|
||||||
OLED::transitionScrollDown();
|
OLED::transitionScrollDown();
|
||||||
scrollingDown = false;
|
scrollingDown = false;
|
||||||
animOpenState = false;
|
animOpenState = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user