Skip to content

Commit

Permalink
use adafruit_ticks methods to handle ticks rollover
Browse files Browse the repository at this point in the history
  • Loading branch information
RetiredWizard committed Jun 24, 2024
1 parent 34bb2f1 commit 666731b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions adafruit_display_text/scrolling_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"

from adafruit_ticks import ticks_ms
import adafruit_ticks
from adafruit_display_text import bitmap_label

try:
Expand Down Expand Up @@ -81,10 +81,10 @@ def update(self, force: bool = False) -> None:
Default is False.
:return: None
"""
_now = ticks_ms()
if _now < self._last_animate_time: # ticks_ms has rolled over
self._last_animate_time = _now
if force or self._last_animate_time + (self.animate_time * 1000) <= _now:
_now = adafruit_ticks.ticks_ms()
if force or adafruit_ticks.ticks_less(
self._last_animate_time + int(self.animate_time * 1000), _now
):
if len(self.full_text) <= self.max_characters:
super()._set_text(self.full_text, self.scale)
self._last_animate_time = _now
Expand Down

0 comments on commit 666731b

Please sign in to comment.