pimoroni / pidi-plugins

🎵 plugins for Pirate Display. A mopidy/mpd album art downloader/displayer.
https://github.com/pimoroni/pidi
11 stars 8 forks source link

Improve CPU usage for pimoroni/mopidy-pidi#2 #1

Closed Gadgetoid closed 4 years ago

Gadgetoid commented 4 years ago

I found some good opportunities to optmise both pidi-display-pil and, as a consequence, pidi-display-st7789 to avoid drawing calls unless:

  1. The volume changes (and thus the bar needs to be redrawn)
  2. The "progress" advances enough that it will visually change (determined in pixels)
  3. An album art transition is happening
  4. The song state has changed (play/pause)