-
-
Notifications
You must be signed in to change notification settings - Fork 7
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] Technichub garbles print output at CI-build 2063 and primehub does not #736
Comments
I think I saw the same behavior recently as well. I didn't take the time to try to reproduce it yet though. This could be due to recent changes in the Bluetooth code that are using more RAM on the Bluetooth chip now. |
Looks like it one data frame from the hub to localhost is missing. But I see no refusal or fail in the trace. after this a frame is missing (with 20 bytes data) The print output:
The program: # from micropython import mem_info
# mem_info()
# import urandom
from pybricks.pupdevices import Remote
from pybricks.hubs import ThisHub
# from pybricks.robotics import DriveBase
from pybricks import version
print(version)
hub = ThisHub()
str1 = "Waiting for remote connection to hub: "
str2 = '"' + str(hub.system.name()) + '" as a ' + version[0] + "\n"
str_all = str1 + str2
#print("Waiting for remote connection to hub:", end=" ")
#print('"' + str(hub.system.name()) + '" as a ' + version[0], "\n")
print(str_all)
#print(len("mote connection to h"))
try:
remote = Remote(timeout=100)
except Exception as e:
print("=======\t\tNo remote connected\t=======\n", e)
raise(SystemExit())
print("Connected to remote:", remote.name(), "\n") The trace is refused as file . . . . |
Trace file uploaded by MSEDGE. Previous attempts failed on FireFox 👎 |
I was able to reproduce the bug, so should be fixed now. You can try the latest CI builds to test. |
Thank you David. Already busy on it 👍 |
of course you are 😆 |
Can you point me to "how to use pybricksdev beta" on windows or Linux. |
The easiest way ensure you are using the "latest" pybricksdev is to use Then run pybricksdev like this:
|
Used build 2096 and later build 2113. The program is the same as above.
A few attempts:
The printed string is sometimes: |
Hmm... maybe there is yet another error code we need to check for. |
In order to reproduce the problem again, I had to print literally the same thing you are printing instead of using runtime values: # from micropython import mem_info
# mem_info()
# import urandom
from pybricks.pupdevices import Remote
from pybricks.hubs import ThisHub
# from pybricks.robotics import DriveBase
from pybricks import version
# print(version)
print("('technichub', '3.2.0b3', 'v3.2.0b3-118-gb193756e on 2022-10-17')")
hub = ThisHub()
# print("Waiting for remote connection to hub:", end=" ")
# print('"' + str(hub.system.name()) + '" as a ' + version[0], "\n")
print('Waiting for remote connection to hub: "Hub_A_2113" as a technichub")')
try:
remote = Remote()
except Exception as e:
print("=======\t\tNo remote connected\t=======\n", e)
raise (SystemExit())
print("Connected to remote:", remote.name(), "\n") |
Not sure if this helps. Frames 135 and 138 send parts of the program to the hub. Frames 155 through 160 is the data send by the hub. again missing 20 bytes. The trace: |
This partially reverts 38d8d2b. The change did not actually fix the bug. The testing method was faulty. Issue: pybricks/support#736
I think the problem is related to starting scanning for the remote at the same time as printing. This seems to cause us to drop one bluetooth packet. |
Seems the case indeed. EDIT: |
The prints are buffered, so it is basically the same as long as it didn't print too much. |
This adds an additional retry in the case where we don't get the correct command status after sending a notification. This seems to happen occasionally when we are printing and trying to connect to the remote at the same time. Fixes: pybricks/support#736
I think I might have fixed it for real this time. |
Is this related to #417? |
Affraid there is good and bad news.... Took firmware from The good: The bad:
DR;TL 4 times the same test now produces the same result:
|
To add to the confusion (sorry)
[EDIT]:
|
Similar, but probably not the same since that issue only appears to affect the move hub and this one only affects the technic/city hubs. |
This reverts commit 7755b28. This caused duplicate output in some cases, so isn't the correct fix. Issue: pybricks/support#736
I'm going to revert the previous "fix" that is causing the extra output for now and try again later. |
3rd attempt seems less hacky, so 🤞 maybe it is fixed for real this time? |
Not to nitpick, but can we avoid merging to master right away if unsure? |
OK on the TechnicHub. print(" 1 2 3 4 5 6 7 8")
print("0123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 ") produces:
With a
|
Great!
Let's continue that discussion on #417 since the issues with the move hub are already described there. |
Similar to efda5d0, this avoids bugs by only allowing the Bluetooth chip to do one thing at a time and blocks other requested tasks until the previous ones have completed. This helps prevent the Bluetooth chip from getting in a bad state and fixes some existing known bugs. We can also now drop the workaround for [1] from 7d7434f (which in addition to the changes in this commit is also now avoided by a01772b). [1]: pybricks/support#736 Fixes: pybricks/support#567
Describe the bug
A print command like:
should produce
but on a Technichub, it produces:
A Spike Prime hub at the same firmware level shows no problem.
To reproduce
Steps to reproduce the behavior:
Expected behavior
Correct print output on both hubs
python program used
Note to me: saved as
/home/bert/py/pybricks/MOC-120171 - motorized defender\print_anomaly_issue.py
Extra info
The original program is larger, but the program above is the shortest I could find having this problem.
Ran on win11 (Edge) and on linux Mint (Google chrome)
In some cases adding
mem_info()
helps to get correct print output.
Does mem_info do garbage collect or something alike?
Screenshots
Not now
The text was updated successfully, but these errors were encountered: