-
-
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] Sensor's only works once. Hub needs restart to make them work again #456
Comments
@Vinz1911 I tried this on my cityhub (as it was next to me) with an UltraSonic sensor:
After disconnect and re-boot the hub: {edit typo] |
Exactly, thats also the behaviour i discovered. With the Color Sensor it shows constantly Color.NONE |
@Vinz1911 I used ambient on the color sensor and THAT keep working the second run.
Part of the second run:
[edit: forgot to paste the program] |
Just as Info: I discovered that you don't need to use the sensor's in Code. You can also run the default main script delivered with the Firmware. Press Start, then Stop will disable the Sensor (Light's Go off) and then they stay off. |
Thanks for opening this issue. This used to be fixed, but it sounds like it has come back. If you want to help, it would be great to know when this started happening by going through older builds. Which was the last build that worked? It's usually best to make big jumps first (like going back a couple of weeks), and then make smaller steps as you get closer.
This is good, because it's relatively quick to see whether it was still working for a particular version. The probably happens because we turn off power to all ports at the end of a program. There is a check to skip this for LEGO sensors with particular properties, but apparently this is no longer being checked. |
Hi Laurens, Yes sure, i will test it later today and give you feedback here 😊 |
Intermediate result, so we do not do all the same ;-)
firmware from firmware from [edit: |
My Results: works fine with (also tested all functions of the sensors): same with the alpha2 and broke with the alpha3 so anything broke with the alpha3 version, all version before seems to work very well |
Thank you both! Bonus points and eternal gratitude shall be awarded for finding the specific commit in between those releases 😄 |
we will do our best 😜 |
Here we go: latest working one: and then broke with:
|
Thanks guys! I'll look into this and make sure to fix it. |
This is also a good reminder to run our physical tests from time to time. We probably need to document this somewhere. |
pybricks/pybricks-micropython@baada48
We'll probably have to have a closer look at this so we don't break it once again. |
And this issue shows that running a test only once is not enough. |
The |
I've found the underlying issue and a workaround. Don't worry too much about understanding the jargon below. Deep down, the problem is that This used to be fine, because before pybricks/pybricks-micropython@4d6d172, we always made at least one call to The workaround is to always make that call anyway. We were considering revising device management and |
pbdrv_counter_get_dev succeeds even when there isn't a counter, so we have to do at least one read to ensure there is a tacho motor. Fixes pybricks/support#456
pbdrv_counter_get_dev succeeds even when there isn't a counter, so we have to do at least one read to ensure there is a tacho motor. Fixes pybricks/support#456
When pybricks/pybricks-micropython@7a24497 finishes building, you can verify if this fixes it. |
Can confirm: OK running Have problems downloading this firmware (using code.pybricks.com and beta.pybricks.com) to both my cityhub and movehub. So it took more time than I wanted. Anyway fix works. |
Thank you Laurens, everything works now (again) es expected 👍 |
Thanks both of you for reporting and verifying! This is a big help, I appreciate it. I'll keep the issue open until it's merged to master. |
Describe the bug
I tried the following on the Inventor Hub with the ColorSensor and the UltraSonic Sensor:
Version: ('primehub', '3.1.0a3', 'v3.1.0a3-62-g51bdd097 on 2021-08-26')
Problem: Sensor's only works on first run of the script after stopping the script and run it again, the sensor's are not working.
After restart of the hub, the sensor's work again for the first run and then the problem appears again.
To reproduce
Steps to reproduce the behavior:
Just run this script, stop it and run it again:
Expected behavior
Sensor's work every time the script is running
The text was updated successfully, but these errors were encountered: