From 1ffb3a9836a691855b31187f2b1b0c01100b3e71 Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Fri, 10 Feb 2023 15:34:13 +0000 Subject: [PATCH] Update IO_OLEDDisplay.h Round up number of characters per line, so that the last few pixels on the line are erased when writing blanks. --- IO_OLEDDisplay.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/IO_OLEDDisplay.h b/IO_OLEDDisplay.h index 1ef8ed1..859f82d 100644 --- a/IO_OLEDDisplay.h +++ b/IO_OLEDDisplay.h @@ -77,8 +77,8 @@ protected: _I2CAddress = i2cAddress; _width = width; _height = height; - _numCols = _width / 6; // character block 6 x 8 - _numRows = _height / 8; + _numCols = (_width+5) / 6; // character block 6 x 8, round up + _numRows = _height / 8; // Round down _charPosToScreen = _numCols; @@ -91,10 +91,7 @@ protected: // Create OLED driver oled = new SSD1306AsciiWire(); - - // Clear the entire screen - oled->clearNative(); - + addDevice(this); } @@ -115,6 +112,10 @@ protected: // Force all rows to be redrawn for (uint8_t row=0; row<_numRows; row++) _rowGeneration[row]++; + + // Start with top line (looks better) + _rowNoToScreen = _numRows; + _charPosToScreen = _numCols; } }