Open davidwu226 opened 9 months ago
Thank you.
Can you please report the result of this script?
from pybricks import version
print(version)
We recently fixed something like this, so hopefully we're all good when we release this new version.
I can confirm that this is still an issue with the latest release candidate as well. Thanks for reporting!
This also appears to be another case where the MicroPython system abort is not working, so maybe we should revert that one at some point too.
The issue seems to only occur if it is called again before the first frame update.
This adapted script always works correctly for any delay > 0
.
from pybricks.hubs import PrimeHub
from pybricks.tools import wait, Matrix
hub = PrimeHub()
delay = 5
x = Matrix([
[255,255,255,255,255],
[255, 0, 0, 0, 0],
[255, 0, 0, 0, 0],
[255, 0, 0, 0, 0],
[255, 0, 0, 0, 0],
])
while True:
hub.display.animate([x, x], delay)
wait(delay + 1)
Simple color animations are also affected, so we must have had this bug for a long time :smile:
from pybricks.hubs import PrimeHub
from pybricks.parameters import Color
from pybricks.tools import wait
hub = PrimeHub()
while True:
hub.light.animate([Color.RED, Color.GREEN, Color.NONE], interval=10)
wait(10)
This also appears to be another case where the MicroPython system abort is not working, so maybe we should revert that one at some point too.
This is only partially true. Running the color animation is escapable with the old system abort (3.3b6
) but the matrix animation isn't. This was already broken in Pybricks 3.2.
It could also be another case where running the pbio
event loop happens while renewing the memory for the animation in common_LightMatrix_animate
.
Describe the bug
If I call hub.display.animate() repeatedly, the Spike Hub sometimes hang. Hitting the center button does not stop the program nor does hitting the stop button in the IDE. I will have to take out the battery in order to reset the hub.
To reproduce
Run the above and try to hit the center button to stop the program. If it works, try again (or turn off the hub and start it again).
Expected behavior I should be able to stop the hub using the center button or by hitting stop in the IDE.