Fix oled_render to render all dirty blocks. (#18887)

This commit is contained in:
Richard Nash 2022-11-13 10:49:59 -05:00 committed by GitHub
parent 81bf60a636
commit 4c1d8a0eb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,18 +291,18 @@ static void rotate_90(const uint8_t *src, uint8_t *dest) {
}
void oled_render(void) {
if (!oled_initialized) {
return;
}
// Do we have work to do?
oled_dirty &= OLED_ALL_BLOCKS_MASK;
if (!oled_dirty || oled_scrolling) {
if (!oled_dirty || !oled_initialized || oled_scrolling) {
return;
}
// Find first dirty block
// Turn on display if it is off
oled_on();
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))) {
++update_start;
}
@ -345,11 +345,9 @@ void oled_render(void) {
}
}
// Turn on display if it is off
oled_on();
// Clear dirty flag
// Clear dirty flag of just rendered block
oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start);
}
}
void oled_set_cursor(uint8_t col, uint8_t line) {