Fixup oled drawing for fill area

This commit is contained in:
Ben V. Brown
2024-04-03 18:28:44 +11:00
parent ccdbc8029f
commit 2450b65229
2 changed files with 8 additions and 13 deletions

View File

@@ -706,7 +706,7 @@ void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uin
if (x <= -wide) { if (x <= -wide) {
return; // cutoffleft return; // cutoffleft
} }
if (x > 96) { if (x > OLED_WIDTH) {
return; // cutoff right return; // cutoff right
} }
@@ -717,21 +717,17 @@ void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uin
if (x < 0) { if (x < 0) {
visibleStart -= x; // subtract negative value == add absolute value visibleStart -= x; // subtract negative value == add absolute value
} }
if (x + wide > 96) { if (x + wide > OLED_WIDTH) {
visibleEnd = 96 - x; visibleEnd = OLED_WIDTH - x;
} }
if (y == 0) { uint8_t rowsDrawn = 0;
// Splat first line of data while (height > 0) {
for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) { for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
stripPointers[0][xx + x] = value; stripPointers[(y / 8) + rowsDrawn][x + xx] = value;
}
}
if (y == 8 || height == 16) {
// Splat the second line
for (uint8_t xx = visibleStart; xx < visibleEnd; xx++) {
stripPointers[1][x + xx] = value;
} }
height -= 8;
rowsDrawn++;
} }
} }

View File

@@ -49,7 +49,6 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
} }
} else { } else {
// Draw in missing tip symbol // Draw in missing tip symbol
if (OLED::getRotation()) { if (OLED::getRotation()) {
// in right handed mode we want to draw over the first part // in right handed mode we want to draw over the first part
OLED::drawArea(54, 0, 56, 32, disconnectedTipF); OLED::drawArea(54, 0, 56, 32, disconnectedTipF);