Skip to content

Commit eed66c7

Browse files
committed
clear on ctor dtor
1 parent 964760a commit eed66c7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,10 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
881881
} else if (strcmp("oled128x32default", msgDeviceInitReq->i2c_device_name) ==
882882
0 ||
883883
strcmp("oled128x32large", msgDeviceInitReq->i2c_device_name) ==
884+
0 ||
885+
strcmp("oled128x64default", msgDeviceInitReq->i2c_device_name) ==
886+
0 ||
887+
strcmp("oled128x64large", msgDeviceInitReq->i2c_device_name) ==
884888
0) {
885889
WS_DEBUG_PRINTLN("SSD1306 display detected!");
886890
_ssd1306 = new WipperSnapper_I2C_Driver_Out_Ssd1306(this->_i2c, i2cAddress);

src/components/i2c/drivers/WipperSnapper_I2C_Driver_Out_Ssd1306.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306
5353
*/
5454
~WipperSnapper_I2C_Driver_Out_Ssd1306() {
5555
if (_display != nullptr) {
56+
_display->clearDisplay();
57+
_display->display();
5658
_display->ssd1306_command(SSD1306_DISPLAYOFF);
5759
delete _display;
5860
_display = nullptr;
@@ -68,13 +70,14 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306
6870
_display = new Adafruit_SSD1306(_width, _height, _i2c);
6971
if (!_display->begin(SSD1306_SWITCHCAPVCC, _sensorAddress))
7072
return false;
71-
// Clear the buffer
72-
_display->clearDisplay();
7373
// Configure the text size and color
7474
_display->setTextSize(_text_sz);
7575
_display->setTextColor(SSD1306_WHITE);
7676
// Use full 256 char 'Code Page 437' font
7777
_display->cp437(true);
78+
// Clear the buffer
79+
_display->clearDisplay();
80+
_display->display();
7881
return true;
7982
}
8083

0 commit comments

Comments
 (0)