adafruit/Adafruit_CircuitPython_LED_Animation

cycle_complete is not triggering for Chase animation

cjsieh opened this issue · 4 comments

Recently changes were made in how anim.draw_count is updated in animation/init.py . Near line 102/105 anim.draw_count is incremented. Thus it is incremented 2 times.
The issue is that in chase.py at line 119 a check is done on draw_count . This check does a % with "num of pixels" . This test is never true now that draw_count is incremented twice and thus cycle_complete is never set.
Solutions are to remove the anim.draw_count increment at line 105 in animation/init.py or modify chase.py to handle this change of draw_count .
I can provide PR for either way, which would you prefer or something else. Both comet and sparkle work with the suggested change to animation/init.py .

I'll try to take a look at this tomorrow

To reproduce this issue modify example/led_animation_sequence.py
replace in line 29
"advance_interval=3"
with
"advance_on_cycle_complete=True"

Results are blink and comet run 1 time each
chase then keeps running because cycle_complete is never triggered

As mentioned one solution is to comment out line 105 in animation/init.py

Good catch, @cjsieh. If you want to submit a PR, we can get your fix merged!

closed via PR #58