Skip to content

Add per-zone (partial) refresh for the IT8951 display#1

Open
pierrehenrymuller wants to merge 1 commit into
GuySie:mainfrom
pierrehenrymuller:partial-refresh
Open

Add per-zone (partial) refresh for the IT8951 display#1
pierrehenrymuller wants to merge 1 commit into
GuySie:mainfrom
pierrehenrymuller:partial-refresh

Conversation

@pierrehenrymuller

Copy link
Copy Markdown

Hi,

Thanks a lot for this component, I've been using it daily on a reTerminal E1003.
Here are the per-zone refresh changes I added and validated on my hardware, hope they're useful to you.

Tested on Seeed reTerminal E1003 (10.3", 1872x1404) hardware.

Why

The component only did full-screen GC16 (visible flash, ~1s), fine for the deep-sleep art-frame, but not for an always-on dashboard with frequent updates.

What

  • full_refresh(): the existing full-screen INIT+GC16 path (unchanged behaviour), now exposed publicly.

  • render_framebuffer() + flush_zone(x, y, w, h, mode=1): render the framebuffer once, the push only a rectangle with a fast waveform (DU, no flash). Logical coordinates are mapped to panel coordinates (the buffer is X-mirrored) and x/width are aligned to 4 px (4bpp). A counter forces a full GC16 every N partials to clear ghosting.

  • fill(Color) override using memset instead of the per-pixel base loop (~2.6M draw calls on this 1872x1404 panel) -> the per-frame auto-clear becomes ~instant.

Notes

  • No change to the existing full-refresh behaviour; the new methods are opt-in, callable from a lambda (e.g. d(my_display).flush_zone(...)).

  • DU is black/white; periodic GC16 (or the existing deghost) clears ghosting.

Good day

@pierrehenrymuller

Copy link
Copy Markdown
Author

Example: a clock that updates every minute without flashing

Render the framebuffer once (cheap thanks to the memset fill()), then push only the rectangle that changed with flush_zone() — it uses the DU waveform, so there is no full-screen flash. Use full_refresh() (GC16) only occasionally, e.g. once a day, to clear any accumulated ghosting.

time:
  - platform: homeassistant
    id: ha_time
    on_time:
      - seconds: 0          # every minute
        then:
          - lambda: |-
              id(my_display).render_framebuffer();        // redraw RAM buffer (lambda)
              id(my_display).flush_zone(0, 0, 360, 120);  // push only the clock area (x,y,w,h) in DU

# Daily clean-up to clear ghosting from the partial (DU) updates:
# on_time -> at 05:00 -> id(my_display).full_refresh();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant