You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Pressing stop button during long print reboots Technic Hub. #1152
Describe the bug
I was debugging sensors and came across something that was ultimately not related to sensors at all. But since it can happen with sensors, it is somewhat likely for users to encounter it.
To reproduce
Install this program on the hub and stay connected to Pybricks Code.
Press the hub button repeatedly. Eventually you will press it while the green light is on. Then it stays on and the hub reboots with PBDRV_RESET_REASON_WATCHDOG
frompybricks.hubsimportThisHubfrompybricks.parametersimportColorhub=ThisHub()
hub.light.on(Color.GREEN)
print("""Traceback (most recent call last): File "sensorinit.py", line 10, in <module>OSError: [Errno 19] ENODEV: A sensor or motor is not connected to the specified port:--> Check the cables to each motor and sensor.--> Check the port settings in your script.--> Check the line in your script that matches the line number given in the 'Traceback' above.""")
Expected behavior
No crash.
Addional notes
I think I was able to reproduce this on Prime Hub at least once, but it is much less likely to occur.
After trying out surrounding commits, this turns out to be fixed by pybricks/pybricks-micropython@ce8a7c9. This makes sense since we added waiting for pbsys_bluetooth_tx_is_idle when stopping the program.
Activity
laurensvalk commentedon Feb 27, 2024
This is still happening in V3.4.0b2.
laurensvalk commentedon Oct 1, 2024
This was still happening in v3.4.0 but no longer in v3.5.0.
laurensvalk commentedon Oct 1, 2024
After trying out surrounding commits, this turns out to be fixed by pybricks/pybricks-micropython@ce8a7c9. This makes sense since we added waiting for
pbsys_bluetooth_tx_is_idlewhen stopping the program.