ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
2.01k stars 638 forks source link

Speed, lots of it! #400

Open ropg opened 6 months ago

ropg commented 6 months ago

Making this an issue instead of a PR because I see an "issue" but am not sure it's in scope to fix: on Arduino, I just noticed the print functions do not actually print the whole string at once, even though the print Class does provide a char* function to print a bunch of chars at once. So my mechanism to inhibit writing to the display for every 'write' until the whole string is written never actually did anything and it actually redrew the text buffer every character, which just wasn't noticed because the library is so damn fast. But naturally printing and scrolling could be even faster if we fixed this somehow.

A fix would entail a 1 ms timer that is restarted every time a character is written, and then the actual drawLogBuffer only happens when the timer reaches zero. But that would involve platform-dependent things like timers, which I'd be happy to do for ESP32 just because it's fun to make it really cool, but I'm also not sure we should. I could use the last timer, and hope the user in their code doesn't use that. But it might get a bit iffy. And these displays are tiny, so it's not like people cat large text files to it.

Thoughts?