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] Remote light does not work well with async #1357

Closed
laurensvalk opened this issue Dec 28, 2023 · 9 comments
Closed

[bug] Remote light does not work well with async #1357

laurensvalk opened this issue Dec 28, 2023 · 9 comments
Assignees
Labels
bug Something isn't working hub: handset Issues related to the LEGO Powered Up Handset (remote control) software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: bluetooth Issues involving bluetooth

Comments

@laurensvalk
Copy link
Member

I also did install the latest nightly firmware build for the technic hub. But I always have problems when I use remote and async on the technic hub together.
This is just a simple program. The remote is connected just for a short time, and then it is disconnected without any error message.

Block_Code_Technic_Hub

The same program is running on a move hub without any issues.

Originally posted by @mahil in #1281 (comment)

@dlech dlech added bug Something isn't working topic: bluetooth Issues involving bluetooth software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) hub: handset Issues related to the LEGO Powered Up Handset (remote control) labels Dec 28, 2023
@laurensvalk
Copy link
Member Author

Thanks for reporting this.

Writing values asynchronously remains a tricky issue on the Technic Hub. Maybe we should not make the remote hub light controllable with blocks to make this less of an issue.

The button state can still be read without issues (which is probably the most important part of the remote).

@laurensvalk
Copy link
Member Author

@mahil - does it work better if delete the remote light blocks (and keep the remote is pressed block)?

@mahil
Copy link

mahil commented Dec 29, 2023

@mahil - does it work better if delete the remote light blocks (and keep the remote is pressed block)?

Yes, it works.

@mahil
Copy link

mahil commented Dec 29, 2023

I did another test. The lights shall only be sets once when the status has changed in the loop. But this test failed as well.

Screenshot_20231229_114659

@mahil
Copy link

mahil commented Dec 29, 2023

Thanks for reporting this.

Writing values asynchronously remains a tricky issue on the Technic Hub. Maybe we should not make the remote hub light controllable with blocks to make this less of an issue.

The button state can still be read without issues (which is probably the most important part of the remote).

I believe it would be better to keep the lights for the remote control, but do not allow multitask instead (when you are using a remote controller). Otherwise, you cannot send any feedback to the user.

My bug report was just an example that something is not working as expected. This example can run in a single task without any problems.

@BertLindeman
Copy link

Maybe same situation in #1373.
Async and bluetooth combined crash the Technic hub.

@laurensvalk laurensvalk self-assigned this Jan 28, 2024
@laurensvalk
Copy link
Member Author

We released a new beta version that fixes this. The following program used to crash within seconds, but now it works fine:

image

You can try it out with the new firmware at https://beta.pybricks.com/

If you've used that page before, it may take a few minutes for the latest version to load in the background. If you go to settings/about, you'll see 3.4.0b1 as the new version:

image

@laurensvalk
Copy link
Member Author

The source code with the fix will be published within a few weeks alongside a fun new feature.

There were a few issues here. This was not related to async in the end. The data being written to the remote was not statically allocated, so it could be gone by the time it would send it to the remote. We've had this bug for a while, but it wasn't so noticeable without async which has a lot more going on in parallel.

Thanks again for reporting!

@laurensvalk
Copy link
Member Author

This has been fixed and the source has now been published, so we can close this issue.

Main fix via pybricks/pybricks-micropython@8a47892

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: handset Issues related to the LEGO Powered Up Handset (remote control) software: pybricks-micropython Issues with Pybricks MicroPython firmware (or EV3 runtime) topic: bluetooth Issues involving bluetooth
Projects
None yet
Development

No branches or pull requests

4 participants