From e25dd2835ae76eb12f510b38440e65959c58c883 Mon Sep 17 00:00:00 2001 From: Shubham Patel <165564832+shubham0x13@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:09:03 +0530 Subject: [PATCH] Optimize ScrollingLabel update logic to prevent redundant text updates --- adafruit_display_text/scrolling_label.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_display_text/scrolling_label.py b/adafruit_display_text/scrolling_label.py index 2031c5d..02d4ef6 100644 --- a/adafruit_display_text/scrolling_label.py +++ b/adafruit_display_text/scrolling_label.py @@ -86,7 +86,8 @@ def update(self, force: bool = False) -> None: 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) + if self._text != self.full_text: + super()._set_text(self.full_text, self.scale) self._last_animate_time = _now return