Skip to content

Commit 5353178

Browse files
authored
Merge pull request #208 from RetiredWizard/monoprecision
Use adafruit_ticks.ticks_ms for scrolling_label animation
2 parents 608833a + 666731b commit 5353178

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

adafruit_display_text/scrolling_label.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
__version__ = "0.0.0+auto.0"
2727
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"
2828

29-
import time
29+
import adafruit_ticks
3030
from adafruit_display_text import bitmap_label
3131

3232
try:
@@ -81,8 +81,10 @@ def update(self, force: bool = False) -> None:
8181
Default is False.
8282
:return: None
8383
"""
84-
_now = time.monotonic()
85-
if force or self._last_animate_time + self.animate_time <= _now:
84+
_now = adafruit_ticks.ticks_ms()
85+
if force or adafruit_ticks.ticks_less(
86+
self._last_animate_time + int(self.animate_time * 1000), _now
87+
):
8688
if len(self.full_text) <= self.max_characters:
8789
super()._set_text(self.full_text, self.scale)
8890
self._last_animate_time = _now

docs/conf.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
# Uncomment the below if you use native CircuitPython modules such as
2828
# digitalio, micropython and busio. List the modules you use. Without it, the
2929
# autodoc module docs will fail to generate with a warning.
30-
autodoc_mock_imports = ["displayio", "adafruit_bitmap_font", "fontio", "bitmaptools"]
30+
autodoc_mock_imports = [
31+
"displayio",
32+
"adafruit_bitmap_font",
33+
"fontio",
34+
"bitmaptools",
35+
]
3136

3237

3338
intersphinx_mapping = {

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
Adafruit-Blinka-displayio>=0.10.2
66
Adafruit-Blinka
77
adafruit-circuitpython-bitmap-font
8+
adafruit-circuitpython-ticks

0 commit comments

Comments
 (0)