Skip to content

Commit dbafddf

Browse files
committed
Properly draw black lines.
1 parent 1ab0db5 commit dbafddf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

OLEDDisplay.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void OLEDDisplay::drawHorizontalLine(int16_t x, int16_t y, int16_t length) {
255255
}
256256

257257
void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length) {
258-
if (x < 0 || x > DISPLAY_WIDTH) return;
258+
if (x < 0 || x >= DISPLAY_WIDTH) return;
259259

260260
if (y < 0) {
261261
length += y;
@@ -285,9 +285,9 @@ void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length) {
285285
}
286286

287287
switch (color) {
288-
case WHITE: *bufferPtr |= drawBit; break;
289-
case BLACK: *bufferPtr &= drawBit; break;
290-
case INVERSE: *bufferPtr ^= drawBit; break;
288+
case WHITE: *bufferPtr |= drawBit; break;
289+
case BLACK: *bufferPtr &= ~drawBit; break;
290+
case INVERSE: *bufferPtr ^= drawBit; break;
291291
}
292292

293293
if (length < yOffset) return;
@@ -320,9 +320,9 @@ void OLEDDisplay::drawVerticalLine(int16_t x, int16_t y, int16_t length) {
320320
if (length > 0) {
321321
drawBit = (1 << (length & 7)) - 1;
322322
switch (color) {
323-
case WHITE: *bufferPtr |= drawBit; break;
324-
case BLACK: *bufferPtr &= drawBit; break;
325-
case INVERSE: *bufferPtr ^= drawBit; break;
323+
case WHITE: *bufferPtr |= drawBit; break;
324+
case BLACK: *bufferPtr &= ~drawBit; break;
325+
case INVERSE: *bufferPtr ^= drawBit; break;
326326
}
327327
}
328328
}

0 commit comments

Comments
 (0)