Fix oled_render to render all dirty blocks. (#18887)
This commit is contained in:
parent
81bf60a636
commit
4c1d8a0eb3
1 changed files with 49 additions and 51 deletions
|
@ -291,18 +291,18 @@ static void rotate_90(const uint8_t *src, uint8_t *dest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void oled_render(void) {
|
void oled_render(void) {
|
||||||
if (!oled_initialized) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do we have work to do?
|
// Do we have work to do?
|
||||||
oled_dirty &= OLED_ALL_BLOCKS_MASK;
|
oled_dirty &= OLED_ALL_BLOCKS_MASK;
|
||||||
if (!oled_dirty || oled_scrolling) {
|
if (!oled_dirty || !oled_initialized || oled_scrolling) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find first dirty block
|
// Turn on display if it is off
|
||||||
|
oled_on();
|
||||||
|
|
||||||
uint8_t update_start = 0;
|
uint8_t update_start = 0;
|
||||||
|
while (oled_dirty) { // render all dirty blocks
|
||||||
|
// Find next dirty block
|
||||||
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
|
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
|
||||||
++update_start;
|
++update_start;
|
||||||
}
|
}
|
||||||
|
@ -345,12 +345,10 @@ void oled_render(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn on display if it is off
|
// Clear dirty flag of just rendered block
|
||||||
oled_on();
|
|
||||||
|
|
||||||
// Clear dirty flag
|
|
||||||
oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start);
|
oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void oled_set_cursor(uint8_t col, uint8_t line) {
|
void oled_set_cursor(uint8_t col, uint8_t line) {
|
||||||
uint16_t index = line * oled_rotation_width + col * OLED_FONT_WIDTH;
|
uint16_t index = line * oled_rotation_width + col * OLED_FONT_WIDTH;
|
||||||
|
|
Loading…
Reference in a new issue