mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 16:38:43 +00:00
[ssd1322][ssd1325][ssd1327] Fix nibble mask bug in grayscale draw_pixel (#14496)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -169,7 +169,7 @@ void HOT SSD1322::draw_absolute_pixel_internal(int x, int y, Color color) {
|
||||
// ensure 'color4' is valid (only 4 bits aka 1 nibble) and shift the bits left when necessary
|
||||
color4 = (color4 & SSD1322_COLORMASK) << shift;
|
||||
// first mask off the nibble we must change...
|
||||
this->buffer_[pos] &= (~SSD1322_COLORMASK >> shift);
|
||||
this->buffer_[pos] &= (static_cast<uint8_t>(~SSD1322_COLORMASK) >> shift);
|
||||
// ...then lay the new nibble back on top. done!
|
||||
this->buffer_[pos] |= color4;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ void HOT SSD1325::draw_absolute_pixel_internal(int x, int y, Color color) {
|
||||
// ensure 'color4' is valid (only 4 bits aka 1 nibble) and shift the bits left when necessary
|
||||
color4 = (color4 & SSD1325_COLORMASK) << shift;
|
||||
// first mask off the nibble we must change...
|
||||
this->buffer_[pos] &= (~SSD1325_COLORMASK >> shift);
|
||||
this->buffer_[pos] &= (static_cast<uint8_t>(~SSD1325_COLORMASK) >> shift);
|
||||
// ...then lay the new nibble back on top. done!
|
||||
this->buffer_[pos] |= color4;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void HOT SSD1327::draw_absolute_pixel_internal(int x, int y, Color color) {
|
||||
// ensure 'color4' is valid (only 4 bits aka 1 nibble) and shift the bits left when necessary
|
||||
color4 = (color4 & SSD1327_COLORMASK) << shift;
|
||||
// first mask off the nibble we must change...
|
||||
this->buffer_[pos] &= (~SSD1327_COLORMASK >> shift);
|
||||
this->buffer_[pos] &= (static_cast<uint8_t>(~SSD1327_COLORMASK) >> shift);
|
||||
// ...then lay the new nibble back on top. done!
|
||||
this->buffer_[pos] |= color4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user