Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Prime Hub stays on after software power-off if USB connected. #381

Closed
laurensvalk opened this issue Jul 1, 2021 · 4 comments
Closed
Labels
bug Something isn't working hub: primehub/inventorhub Issues related to the LEGO SPIKE Prime hub and LEGO MINDSTORMS Robot Invetor hub software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime)

Comments

@laurensvalk
Copy link
Member

laurensvalk commented Jul 1, 2021

Describe the bug
When triggering a soft power-off while USB is connected, it does not shut down in the same way as holding the button.

The animation freezes and Pybricks Code stays connected (but fails to run anything).

To reproduce

from pybricks.hubs import ThisHub
from pybricks.tools import wait

hub = ThisHub()

print(hub.system.reset_reason())
wait(100)
hub.system.reset(0) # Already applied support#379, so here doing power-off

# The run animation stays on and freezes

Expected behavior
Clean shutdown, same as holding the button.

Screenshots

image

IMG_20210701_140214468

@laurensvalk laurensvalk added triage Issues that have not been triaged yet bug Something isn't working hub: primehub/inventorhub Issues related to the LEGO SPIKE Prime hub and LEGO MINDSTORMS Robot Invetor hub software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) and removed triage Issues that have not been triaged yet labels Jul 1, 2021
@dlech
Copy link
Member

dlech commented Jul 1, 2021

0 is supposed to reset the hub, not power off. See #382 for power off.

@laurensvalk
Copy link
Member Author

See #379 as indicated in comment.

@dlech
Copy link
Member

dlech commented Jul 1, 2021

We need to add a new method for proper shutdown that calls pbsys_status_set(PBIO_PYBRICKS_STATUS_SHUTDOWN);

laurensvalk added a commit to pybricks/pybricks-micropython that referenced this issue Jul 5, 2021
hub.system.reset(2) is kept in the implementation for backwards-compatibility with system updates, but the other reset variants should not be used, since they can lead to problems like pybricks/support#381

pybricks/support#379
@laurensvalk
Copy link
Member Author

This can be closed because reset will not be used. See #379.

See https://github.com/pybricks/pybricks-micropython/issues/58 for graceful shutdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hub: primehub/inventorhub Issues related to the LEGO SPIKE Prime hub and LEGO MINDSTORMS Robot Invetor hub software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime)
Projects
None yet
Development

No branches or pull requests

2 participants