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

Revert "Refactor SSD1306 initialisation to support different initialisation sequences."

This reverts commit 278a9c52a6.
This commit is contained in:
Neil McKechnie 2023-02-07 17:01:45 +00:00
parent cb287f23a4
commit 0c88c74706

View File

@ -144,10 +144,7 @@ const uint8_t FLASH SSD1306AsciiWire::SH1106_132x64init[] = {
//------------------------------------------------------------------------------
// Constructor
SSD1306AsciiWire::SSD1306AsciiWire() {
I2CManager.begin();
I2CManager.setClock(400000L); // Set max supported I2C speed
}
SSD1306AsciiWire::SSD1306AsciiWire() {}
// CS auto-detect and configure constructor
SSD1306AsciiWire::SSD1306AsciiWire(int width, int height) {
@ -196,7 +193,7 @@ bool SSD1306AsciiWire::begin(I2CAddress address, int width, int height) {
return false;
}
// Device found
DIAG(F("%dx%d OLED display configured on I2C:x%x"), m_displayWidth, m_displayHeight, (int)m_i2cAddr);
DIAG(F("%dx%d OLED display configured on I2C:x%x"), m_displayWidth, m_displayHeight, (uint8_t)m_i2cAddr);
clear();
return true;
}
@ -206,9 +203,8 @@ void SSD1306AsciiWire::clearNative() {
const int maxBytes = sizeof(blankPixels); // max number of bytes sendable over Wire
for (uint8_t r = 0; r <= m_displayHeight/8 - 1; r++) {
setRowNative(r); // Position at start of row to be erased
for (uint8_t c = 0; c <= m_displayWidth - 1; c += maxBytes) {
uint8_t len = m_displayWidth-c;
if (len > maxBytes) len = maxBytes;
for (uint8_t c = 0; c <= m_displayWidth - 1; c += maxBytes-1) {
uint8_t len = min(m_displayWidth-c, maxBytes-1) + 1;
I2CManager.write_P(m_i2cAddr, blankPixels, len); // Write a number of blank columns
}
}