From 0719d68b205ecffd8f93dee07b7dd07d8bc8c615 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 14 Nov 2022 01:49:58 +0000 Subject: Add default limit to OLED dirty processing (#19068) --- drivers/oled/ssd1306_sh1106.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/oled/ssd1306_sh1106.c') diff --git a/drivers/oled/ssd1306_sh1106.c b/drivers/oled/ssd1306_sh1106.c index 9fc8c2d2ad..342920572e 100644 --- a/drivers/oled/ssd1306_sh1106.c +++ b/drivers/oled/ssd1306_sh1106.c @@ -300,8 +300,9 @@ void oled_render(void) { // Turn on display if it is off oled_on(); - uint8_t update_start = 0; - while (oled_dirty) { // render all dirty blocks + uint8_t update_start = 0; + uint8_t num_processed = 0; + while (oled_dirty && num_processed++ < OLED_UPDATE_PROCESS_LIMIT) { // render all dirty blocks (up to the configured limit) // Find next dirty block while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) { ++update_start; -- cgit v1.2.3