Skip to content

Commit

Permalink
Merge pull request #208 from RetiredWizard/monoprecision
Browse files Browse the repository at this point in the history
Use adafruit_ticks.ticks_ms for scrolling_label animation
  • Loading branch information
dhalbert authored Jun 24, 2024
2 parents 608833a + 666731b commit 5353178
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 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"

import time
import adafruit_ticks
from adafruit_display_text import bitmap_label

try:
Expand Down Expand Up @@ -81,8 +81,10 @@ def update(self, force: bool = False) -> None:
Default is False.
:return: None
"""
_now = time.monotonic()
if force or self._last_animate_time + self.animate_time <= _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
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
autodoc_mock_imports = ["displayio", "adafruit_bitmap_font", "fontio", "bitmaptools"]
autodoc_mock_imports = [
"displayio",
"adafruit_bitmap_font",
"fontio",
"bitmaptools",
]


intersphinx_mapping = {
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
Adafruit-Blinka-displayio>=0.10.2
Adafruit-Blinka
adafruit-circuitpython-bitmap-font
adafruit-circuitpython-ticks

0 comments on commit 5353178

Please sign in to comment.