However, the display is way too slow. It takes 330 ms for a call to display() even when nothing is drawn on it.
Attached below is a small sketch, which does nothing except calling display() and measuring the time.
The serial monitor shows 330 for each loop. I get the same result when I display a few rectangles and text, so it's independent of the contents.
I'd understand if transferring data to the screen takes some time, but since nothing is displayed there is nothing to transfer.
I don't know much about the internals of I2C. But it supports speeds around 100kbit/s and more, so even sending the entire screen of 128x64 bits shouldn't take more than 1/10th of a second.
Is it a flaw in the library, or is speed limited by the diplay?
Any help is welcome, thanks!
Code: Select all
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4 // not used
Adafruit_SSD1306 display(OLED_RESET);
long tstart = 0;
long tstop = 0;
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
Serial.begin(9600);
tstart = millis();
}
void loop() {
display.display();
// delay(10);
tstop = millis();
String text = "";
text.concat(tstop-tstart);
Serial.println(text);
tstart = tstop;
}