From dd3a813f871b911012da55a499955307c309a7a5 Mon Sep 17 00:00:00 2001 From: Ryan Caltabiano Date: Tue, 16 Apr 2019 18:36:55 -0500 Subject: Reducing size of data send in one frame & update Zen rev2 oled usage --- drivers/oled/oled_driver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/oled/oled_driver.c') diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index aa025d7a4c..96ea58ccb2 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -203,7 +203,7 @@ bool oled_init(uint8_t rotation) { } __attribute__((weak)) -uint8_t oled_init_user(uint8_t rotation) { +oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; } @@ -384,7 +384,10 @@ void oled_write_char(const char data, bool invert) { // Dirty check if (memcmp(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH)) { - oled_dirty |= (1 << ((oled_cursor - &oled_buffer[0]) / OLED_BLOCK_SIZE)); + uint16_t index = oled_cursor - &oled_buffer[0]; + oled_dirty |= (1 << (index / OLED_BLOCK_SIZE)); + // Edgecase check if the written data spans the 2 chunks + oled_dirty |= (1 << ((index + OLED_FONT_WIDTH) / OLED_BLOCK_SIZE)); } // Finally move to the next char -- cgit v1.2.3