pimoroni / EnviroPlus-FeatherWing

CircuitPython library for the Enviro+ FeatherWing
https://shop.pimoroni.com/products/enviro-plus-featherwing
MIT License
10 stars 11 forks source link

plotter scrolling in default non-full-redraw mode loses pixels in some cases #22

Closed kevinjwalters closed 2 years ago

kevinjwalters commented 3 years ago

The plotting is ok until scrolling happens and then the undraw/redraw pixel code fails to draw back some pixels based on a visual test. This happens with flat lines (plural) but not in all cases.

I'll add some code to demonstrate this later.

kevinjwalters commented 3 years ago

Probably for overlapping multiple plots where points from one colour are undrawn and moved to a different pixel in diffing code but no action is taken for a stationary value and that pixel can be undrawn by former action.

kevinjwalters commented 3 years ago

First fix which visually appears to fix the issue and maintains structure with minimal change, before::

Four lines, 3 ramping took 20.978 seconds
Four lines, 3 ramping took 30.8462 seconds
Three flat lines took 13.0269 seconds
Three flat lines took 28.8727 seconds
Two lines, few draws took 11.9871 seconds
Two lines, few draws took 13.1707 seconds

after

Four lines, 3 ramping took 23.3195 seconds
Four lines, 3 ramping took 30.6644 seconds
Three flat lines took 18.5139 seconds
Three flat lines took 28.8168 seconds
Two lines, few draws took 12.1194 seconds
Two lines, few draws took 13.2567 seconds
kevinjwalters commented 3 years ago

Some of the #19 work replaced the fix here with the same style fix over a fixed-size, circular buffer.

Gadgetoid commented 2 years ago

Thank you again! Whew. :sweat_smile: