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

microphone.current_event: first call returns None but docs don't mention the possibility of None #86

Closed
microbit-matt-hillsdon opened this issue Sep 8, 2021 · 2 comments
Milestone

Comments

@microbit-matt-hillsdon
Copy link
Contributor

https://microbit-micropython.readthedocs.io/en/v2-docs/microphone.html#microbit.microphone.current_event says "return: the name of the last recorded sound event, SoundEvent('loud') or SoundEvent('quiet')"

In practice it seems that the first result is None:

>>> repr(microphone.current_event())
'None'
>>> repr(microphone.current_event())
"SoundEvent('quiet')"

should the docs be updated to mention this or is it a bug in the implementation?

@dpgeorge
Copy link
Collaborator

dpgeorge commented Sep 8, 2021

This looks like a bug and should probably return the "quiet" event for the first call.

dpgeorge added a commit that referenced this issue Sep 10, 2021
The initial sound event is now "quiet", and None is no longer possible.

Fixes issue #86.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
Copy link
Collaborator

Fixed by 69c8ddc

@microbit-carlos microbit-carlos added this to the 2.1 milestone Mar 25, 2022
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

No branches or pull requests

3 participants