greiman/SSD1306Ascii

ShutDown OLED 1306

error105 opened this issue · 2 comments

Hi, there is any option to turn off OLED to save power?

There is no function to turn off the OLED. ssd1306WriteCmd() is public so you could try sending SSD1306_DISPLAYOFF and SSD1306_DISPLAYON.

  oled.ssd1306WriteCmd(SSD1306_DISPLAYOFF);
  ...
  oled.ssd1306WriteCmd(SSD1306_DISPLAYON));

You can try it but I don't know if will save power or work properly.

I have developed a bit of code to avoid the OLED fading off when displaying the same text
Here, I am just diming it, but you can also turn it off with the level of contrast

void setDisplayDIM()
{
        display.ssd1306WriteCmd(SSD1306_SETPRECHARGE);
        display.ssd1306WriteCmd(0);
        display.ssd1306WriteCmd(SSD1306_SETVCOMDETECT);
        display.ssd1306WriteCmd(0);
        display.ssd1306WriteCmd(SSD1306_SETCONTRAST);
        display.ssd1306WriteCmd(10);
}
void setDisplayNORMAL()
{
        display.ssd1306WriteCmd(SSD1306_SETPRECHARGE);
        display.ssd1306WriteCmd(0xF1);
        display.ssd1306WriteCmd(SSD1306_SETVCOMDETECT);
        display.ssd1306WriteCmd(0x20);
        display.ssd1306WriteCmd(SSD1306_SETCONTRAST);
        display.ssd1306WriteCmd(0xAF);
      }

```