From bac273b46d31082f886351420664dbe48c9445e2 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 13 Dec 2024 11:52:07 -0600 Subject: [PATCH 1/2] rainbow commet fix for tail_length > 256 --- adafruit_led_animation/animation/rainbowcomet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_led_animation/animation/rainbowcomet.py b/adafruit_led_animation/animation/rainbowcomet.py index beae255..c22a71f 100644 --- a/adafruit_led_animation/animation/rainbowcomet.py +++ b/adafruit_led_animation/animation/rainbowcomet.py @@ -60,7 +60,7 @@ def __init__( ring=False, ): if step == 0: - self._colorwheel_step = int(256 / tail_length) + self._colorwheel_step = max(int(256 / tail_length), 1) else: self._colorwheel_step = step self._colorwheel_offset = colorwheel_offset From 6ef0715b77c3b286f646db943eb1a30454044883 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 16 Dec 2024 14:47:32 -0600 Subject: [PATCH 2/2] integer division --- adafruit_led_animation/animation/rainbowcomet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_led_animation/animation/rainbowcomet.py b/adafruit_led_animation/animation/rainbowcomet.py index c22a71f..6d4ce19 100644 --- a/adafruit_led_animation/animation/rainbowcomet.py +++ b/adafruit_led_animation/animation/rainbowcomet.py @@ -60,7 +60,7 @@ def __init__( ring=False, ): if step == 0: - self._colorwheel_step = max(int(256 / tail_length), 1) + self._colorwheel_step = max(256 // tail_length, 1) else: self._colorwheel_step = step self._colorwheel_offset = colorwheel_offset