adafruit / adafruit/Adafruit_CircuitPython_LED_Animation
Nesting AnimateOnce inside AnimationSequence causes random animation order
- Langage dominant
- Python
- Étoiles
- 62
- Forks
- 46
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
A user commented on this: https://forums.adafruit.com/viewtopic.php?f=60&t=186732
This (simplified) example, after the first round, does the red and blue animations in random order. Each `Pulse` animation is correct, but, successive `Pulse`s do not strictly alternate between red and blue. Note the `AnimateOnce` inside `AnimationSequence`.
```py
import board
import neopixel
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.sequence import AnimationSequence
from adafruit_led_animation.sequence import AnimateOnce
from adafruit_led_animation.color import RED, BLUE
num_pixels = 24
pixels = neopixel.NeoPixel(board.A0, num_pixels, auto_write=False)
pixels.brightness = 0.2
pulse0 = Pulse(pixels, speed=.05, color=RED, period=1)
pulse1 = Pulse(pixels, speed=.05, color=BLUE, period=1)
animations = AnimationSequence(
AnimateOnce(pulse0,pulse1,),
auto_clear=True,
auto_reset=True,
advance_interval=5,
)
while True:
animations.animate()
```
Removing the nesting works fine. Red and blue alternate, as expected.
```py
import board
import neopixel
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.sequence import AnimateOnce
from adafruit_led_animation.color import RED, BLUE
num_pixels = 24
pixels = neopixel.NeoPixel(board.A0, num_pixels, auto_write=False)
pixels.brightness = 0.2
pulse0 = Pulse(pixels, speed=.05, color=RED, period=1)
pulse1 = Pulse(pixels, speed=.05, color=BLUE, period=1)
animations = AnimateOnce(pulse0,pulse1,
auto_clear=True,
auto_reset=True,
advance_interval=5,
)
while True:
animations.animate()
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par adafruit_led_animation/sequence.py et les points d’entrée AnimationSequence et AnimateOnce, puis exécutez l’exemple imbriqué fourni afin de reproduire le problème d’ordre. Comparez-le avec l’exemple non imbriqué ; le travail est terminé lorsque AnimateOnce imbriqué alterne systématiquement les animations Pulse rouges et bleues après le premier tour.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- embedded-iot
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100