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
1.99k stars 637 forks source link

This fixes a display hang if setFrames(...) is called > 35 seconds after boot #273

Closed geeksville closed 4 years ago

geeksville commented 4 years ago

I noticed a funny problem If you call ui.setFrames(...) and your device has been running for more than about 33 seconds, the display would seem to lock-up and stop updating for up to 30ish seconds. The root cause was that when state gets reset state.lastUpdate becomes zero and therefore the math to calculate time budget can be bigger than what can be represented in a 16 bit int. If you are unlucky your negative number will be thought to be a large postive number and the display drawing would get skipped.

This fixes that by keeping timeBudget as an int32 (which is 'free' because it probably in a register anyways...)

marcelstoer commented 4 years ago

Good catch! Thanks for the fix.