Skip to content

Check background pending before sleep #5182

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

Merged
merged 2 commits into from
Aug 21, 2021
Merged

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Aug 19, 2021

There is a race between when we run background tasks and when we
sleep. If an interrupt happens between the two, then we may delay
executing the background task. On some ports we checked this for
TinyUSB already. On iMX RT, we didn't which caused USB issues.
This PR makes it more generic for all background tasks including
USB.

Fixes #5086 and maybe others.

There is a race between when we run background tasks and when we
sleep. If an interrupt happens between the two, then we may delay
executing the background task. On some ports we checked this for
TinyUSB already. On iMX RT, we didn't which caused USB issues.
This PR makes it more generic for all background tasks including
USB.

Fixes micropython#5086 and maybe others.
@tannewt tannewt added this to the 7.0.0 milestone Aug 19, 2021
@tannewt tannewt requested a review from dhalbert August 19, 2021 19:23
jepler
jepler previously approved these changes Aug 19, 2021
Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me. Nice simplification.

@dhalbert
Copy link
Collaborator

I will do some audio testing when this builds.

@dhalbert
Copy link
Collaborator

Great find, and quick!

I tested audio on RP2040, SAMD51, nRF, ESP32-S2, and STM32F405. There was no change between alpha.6 and this.

STM PWM audio does not sound good, and I'l check on that.

The SAMD21 builds didn't work, so I didn't test those.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for really nailing the background processing down.

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

Successfully merging this pull request may close these issues.

Teensy 4.1 cannot boot 7.0
4 participants