adafruit / Adafruit_CircuitPython_Display_Text

Library to display text using displayio
MIT License
57 stars 38 forks source link

Use adafruit_ticks.ticks_ms for scrolling_label animation #208

Closed RetiredWizard closed 3 months ago

RetiredWizard commented 3 months ago

As described in adafruit/circuitpython#5411 time.monotonic loses precision over time, which eventually causes the scrolling_label animation to occur every time an update method is called. This can result in the scrolling text suddenly speeding up dramatically.

This PR uses supervisor.ticks_ms and adds a bit of logic to watch for the value rolling over instead of time.monotonic() which should resolve the issue. As mentioned by Dan in the referenced issue, another option would be to use time.monotonic_ns and similarly watch for the rollover, however apparently not all boards support the monotonic_ns method.

RetiredWizard commented 3 months ago

The CI didn't like including supervisor. I don't know if that can be fixed in the requirements/toml/??? files somewhere or if it's a bigger issue with the approach.

FoamyGuy commented 3 months ago

I think the step that is failing is the docs build. If you add "supervisor" to the list here: https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/blob/608833a399d21310225c1977c11084927668e732/docs/conf.py#L30 it should be able to complete successfully I think.

RetiredWizard commented 3 months ago

think the step that is failing is the docs build. If you add "supervisor" to the list here:

That did the trick :grin: Thanks!