Fix overrun in oled_write_raw when not at (0, 0) (#13204)
This commit is contained in:
parent
5c3991cb90
commit
83ee79565c
@ -491,8 +491,9 @@ void oled_write_raw(const char *data, uint16_t size) {
|
|||||||
uint16_t cursor_start_index = oled_cursor - &oled_buffer[0];
|
uint16_t cursor_start_index = oled_cursor - &oled_buffer[0];
|
||||||
if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index;
|
if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index;
|
||||||
for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
|
for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
|
||||||
if (oled_buffer[i] == data[i]) continue;
|
uint8_t c = *data++;
|
||||||
oled_buffer[i] = data[i];
|
if (oled_buffer[i] == c) continue;
|
||||||
|
oled_buffer[i] = c;
|
||||||
oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
|
oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user