-
-
Notifications
You must be signed in to change notification settings - Fork 83
USB remove timeout #457
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
base: master
Are you sure you want to change the base?
USB remove timeout #457
Conversation
Remove the USB tx timeout from all drivers. There currently isn't a way to recover from a timeout, so it just breaks the connection. Instead, now, e.g. print statements will block forever if an application disappears without unsubscribing first. This can happen, e.g. if someone closes the browser tab running Pybricks Code without disconnecting USB first (either the cable or using the button in Pybricks Code). This isn't ideal behavior, but we will address what to do about that at a later time.
Enable USB for testing.
13eae02 to
c8f6754
Compare
|
Here is a visual program for testing: from pybricks.hubs import ThisHub
from pybricks.parameters import Color
from pybricks.tools import wait
hub = ThisHub()
while True:
hub.light.on(Color.RED)
print("Red")
wait(100)
hub.light.on(Color.GREEN)
print("Green")
wait(100)The point is to see when the program stalls because of A known way to do this is to run the program in Pybricks Code and then close the browser tab without disconnecting USB first. It would be helpful to find any other ways we can get the program to stall like that. |
I'll go first. 😄 With the program running and USB connected in one Pybricks Code tab, open another Pybricks Code tab. If you have an older version of Pybricks Code, this does a USB reset in the new tab that breaks the connection in the old tab and still managed to stall the print. This should be fixed in https://labs.pybricks.com though since we removed the USB reset already there. It does mean that in our firmware though, we need to make sure to unsubscribe if someone does a USB reset as this doesn't seem to be happening currently. |
Test 1Test with this firmware ev3-firmware-build-4663-gitc8b82544.zip on EV3 in labs as app (after retries due to timeout #2467)
Not very helpful I think. Huh, but wait a minute: Test 2same firmware, same labs app with a continued running program. The program runs on happily. |
This is expected. We will eventually change it to catch this error and pop up a message that says that that the hub is already connected to another program right now.
This is also expected. When Pybricks Code restarts, it tries to automatically connect to USB, which unblocks what the program was hung up on. |
|
Thanks David. Great to have the EV3 on USB on labs. |
This is just for testing for now. This is probably the first step towards unbreaking USB on slow computers.