znalazlem blad w write_to_buffer

This commit is contained in:
2021-05-30 16:43:02 +02:00
parent 218724b5da
commit 2972501cef
4 changed files with 81 additions and 7 deletions

View File

@@ -320,7 +320,7 @@ void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_
mask_buf |= 0xFF >> (8 - (b.shift % 8));
}
uint8_t shifted_pixels_left = (pos_y + bitmap_height) - b.bitmap_row * 8;
uint8_t shifted_pixels_left = (pos_y%8 + bitmap_height) - b.bitmap_row * 8;
if (shifted_pixels_left < 8) {
mask_buf |= (0xFF << shifted_pixels_left);
}
@@ -385,7 +385,7 @@ void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t po
mask_buf |= 0xFF >> (8 - (b.shift % 8));
}
uint8_t shifted_pixels_left = (pos_y + height) - b.bitmap_row * 8;
uint8_t shifted_pixels_left = (pos_y%8 + height) - b.bitmap_row * 8;
if (shifted_pixels_left < 8) {
mask_buf |= (0xFF << shifted_pixels_left);
}
@@ -395,9 +395,9 @@ void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t po
if (bitmap_idx < b.bitmap_max_idx)
{
if (pos_y < 0) {
tmp_buf16 |= color >> (b.shift % 8);
tmp_buf16 |= (color >> (b.shift % 8)) & ~(mask_buf);
} else {
tmp_buf16 |= color << (b.shift % 8);
tmp_buf16 |= (color << (b.shift % 8)) & ~(mask_buf);
}
}