1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-27 06:11:25 +01:00

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.
This commit is contained in:
Neil McKechnie 2023-02-10 15:34:13 +00:00
parent f358880f30
commit 1ffb3a9836

View File

@ -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;
}
}