perf(oled): skip I2C flush when the frame is unchanged

The SH1106 path always pushed the full 1 KB buffer over I2C every endFrame,
even on static screens (clock, home) that don't change between updates. Hash
the GFX buffer (FNV-1a, no external dep — the CRC32 lib is only wired into
e-ink builds) and skip display.display() when it matches the last frame
pushed. _force_redraw forces a flush on the first frame and after
turnOn()/clear() so a post-wake or post-clear frame can't be wrongly skipped.

Mirrors the existing e-ink CRC-skip. Builds green: WioTrackerL1_companion_solo_dual.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-05 22:40:01 +02:00
co-authored by Claude Opus 4.8
parent 9ee199e641
commit 4ae3d22654
2 changed files with 20 additions and 0 deletions
+6
View File
@@ -23,6 +23,12 @@ class SH1106Display : public DisplayDriver
uint8_t _precharge;
bool _use_lemon = false;
int _text_sz;
// Frame-skip: endFrame() hashes the GFX buffer (FNV-1a, no external dep — the
// CRC32 lib is only wired into e-ink builds) and skips the I²C flush when it's
// byte-identical to the last one pushed. _force_redraw guarantees the first
// frame and the frame after turnOn()/clear() always flush.
uint32_t _last_frame_hash = 0;
bool _force_redraw = true;
bool i2c_probe(TwoWire &wire, uint8_t addr);
int16_t drawLemonChar(int16_t x, int16_t y, uint32_t cp);