Skip to content

Commit 666731b

Browse files
committed
use adafruit_ticks methods to handle ticks rollover
1 parent 34bb2f1 commit 666731b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

adafruit_display_text/scrolling_label.py

Lines changed: 5 additions & 5 deletions
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-
from adafruit_ticks import ticks_ms
29+
import adafruit_ticks
3030
from adafruit_display_text import bitmap_label
3131

3232
try:
@@ -81,10 +81,10 @@ def update(self, force: bool = False) -> None:
8181
Default is False.
8282
:return: None
8383
"""
84-
_now = ticks_ms()
85-
if _now < self._last_animate_time: # ticks_ms has rolled over
86-
self._last_animate_time = _now
87-
if force or self._last_animate_time + (self.animate_time * 1000) <= _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+
):
8888
if len(self.full_text) <= self.max_characters:
8989
super()._set_text(self.full_text, self.scale)
9090
self._last_animate_time = _now

0 commit comments

Comments
 (0)