adafruit / adafruit/Adafruit_CircuitPython_LED_Animation
Nesting AnimateOnce inside AnimationSequence causes random animation order
- 主要言語
- Python
- スター
- 62
- フォーク
- 46
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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()
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず adafruit_led_animation/sequence.py と AnimationSequence および AnimateOnce のエントリーポイントを確認し、次に、順序の問題を再現するために提供されたネストされた例を実行します。ネストされていない例と比較します。完了条件は、ネストされた AnimateOnce が 1 回目のラウンドの後、赤と青の Pulse アニメーションを一貫して交互に実行することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- embedded-iot
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100