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

picoexplorer.get_adc(x) hangs #52

Closed
lowfatcode opened this issue Feb 10, 2021 · 3 comments · Fixed by #54
Closed

picoexplorer.get_adc(x) hangs #52

lowfatcode opened this issue Feb 10, 2021 · 3 comments · Fixed by #54

Comments

@lowfatcode
Copy link
Member

When attempting to read an ADC channel from Micro Python the Pico hangs completely.

@lesp
Copy link

lesp commented Feb 10, 2021

Thonny shell becomes unresponsive, and I have to power off the Pico to regain shell.

Screenshot from 2021-02-10 18-02-17

@UnfinishedStuff
Copy link
Contributor

UnfinishedStuff commented Feb 10, 2021

After a bit of poking, this seems to happen if you don't call picoexplorer.init() first. You need to pass init() a bytearray, but if you're not using the screen it can be an array with just a value of zero.

Presumably this is because init also initialises the ADCs.

@ZodiusInfuser
Copy link
Member

Thanks for pointing this out @lesp! As @UnfinishedStuff mentions, the cause of the problem is that you're not calling picoexplorer.init(<bytearray>) before you attempt to read the ADC, which means an instance of PicoExplorer does not exist at that point.

This is something we should be handling gracefully, so what I'll do is have each function fire off a RuntimeException in this case that will instruct the user that init needs to be called, like:

image

Quick question though. How should I do the wording for that error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants