-
Notifications
You must be signed in to change notification settings - Fork 11
Improved use of memory in ScreenPlotter, some bug fixes and an enhancement #24
Conversation
…ug with scrolling. pimoroni#22
Removing unnecessary per-draw display.show() invocation. In draw() turing off display.auto_refresh if on at start and restoring it at end.
The pixels for each column are now undrawn first for all lines and then drawn back unconditionally to deal with pixel overlaps.
Default is now based on the pixel dimensions of the screen but can be specified with width, height kwargs.
…ffer pimoroni#19. A single list is now preallocated at a fixed size and not replaced with slices to reduce continual allocations and fragmentation. Includes fix for calling update() several times before draw(). The full_refresh implementation now only clears the bitmap when it scrolls. Removed the commented-out code.
pimoroni#19. Adding new test with some patterns and variable number of values to look for bugs around scrolling.
Re-implemented with a keyword argument (auto_show) to control whether ScreenPlotter invokes show(). plotters_combined depends on this functionality. Adapted tests in plotter_test.py to use both approaches.
…exceeded. pimoroni#19 Discarding data which cannot be stored by update() if internal buffer capacity is exceeded, exceptions can be thrown if auto_discard is set to False. plotters_combined relies upon data being discarded by update(whatever, draw=False) for plots not on screen. Updating plotters_test to perform 32 undrawn update() in test_twolinesfewdraws.
@dglaude This looks good if you wish to test on your FeatherS2 setup with Enviro+ FeatherWing and PMS5003. This goes with the standard Pimoroni setup described in https://www.instructables.com/Using-the-Pimoroni-Enviro-FeatherWing-With-the-Ada/ and pimoroni/pms5003-circuitpython#8 |
@Gadgetoid This together with pimoroni/pms5003-circuitpython#8 makes the Enviro+ FeatherWing more robust and more memory efficient, let me know what you think. If/when this is all applied it would be great to get a refresh of submodules and a new release for this. |
I've half broken the page turning for |
…age buglet with interval > 1. pimoroni#23
I've effectively tested this on 6.2.0 too while developing support for SCD-30 CO2 sensor. |
@Gadgetoid If you've got the FeatherWing out you might want to review the four outstanding (in every respect) PRs for this repo. |
Of course I attempted to merge the other, smaller PRs and made a total hash of things- conflicting this PR. Sorry for the lack of response here, I've been totally overwhelmed with a mixture of life and the million other things vying for my attention. I think I've got an EnviroPlus FeatherWing that survived my move down-south somewhere, but your incredible level of diligence here makes me extremely tempted just to merge 😄 (I don't have more than one Feather board to test with at the moment 😬) |
I did a lot of testing but it's always possible to miss something. That was all pre CircuitPython 7 and only on Feather nRF52840. Worth giving it all a go on an M4 board with CPy 7. |
Okay, merge conflict fixed! I say we do or die with this 🚀 Oh and- thank you, very much! This project is a little bit on the fringe of my knowledge so it's difficult to keep things tip top, though I'm slowly starting to work more generally with CircuitPython. |
The
plotters_combined
example dies with aMemoryError
on a Feather nRF52840 Express with a PMS5003 attached to an Enviro+ FeatherWing. These changes address this.width=None, height=None, extra_data=16, auto_show=True, auto_discard=True
plotters_combined with PMS5003 blows up after a few minutes with MemoryError in update - replace with fixed size, circular buffer #19 plotter enhancements - fill for redraw and inhibit refresh during drawing #23extra_data
is how many data_points are stored beyond those on the screen for efficient redrawing and allowing user program to jump scroll if desired.auto_show
allows the display.show to be disabled to allow a program more control and efficient use viaobject.group
auto_discard
determines what happens if more data_points are added thanextra_data
without callingdraw()
- aFalse
value will raise an exception.fill()
introduced in CircuitPython 5.3.0 plotter enhancements - fill for redraw and inhibit refresh during drawing #23plotter_test.py
to aid testing with visual verification and checking performanceTested with
plotters_combined.py
andplotter_test.py
on Feather nRF52840 Express with6.0.0
.plotters_combined
runs fine with PMS5003 inpassive
mode for at least 12.5hrs atinterval = 0.2
(code floors at 1s) based on testing. It starts around 53k free memory and stays constant at 30k once it starts scrolling.plotters_combined
runs fine with PMS5003 inactive
mode for at least 5hrs, rest is same as above.No dependency on #21 but that could be reviewed at same time as this and applied beforehand.