Skip to content

canio: Run background tasks while waiting for message reception #5175

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 3 commits into from
Aug 20, 2021

Conversation

jepler
Copy link

@jepler jepler commented Aug 18, 2021

While I don't have enough information to determine if this is what affected the original reporter, I had an stm32f405 feather that readily reproduced the problem. I eventually discovered that the problem affected me only when I had a program that used canio and was spending all its time waiting in common_hal_canio_listener_receive for a packet that never arrived. This was due to missing background task & interrupt key checking in the blocking loop in common_hal_canio_listener_receive.

I added the extra code to both esp32-s2, samd and st code, but only tested stm32f405 feather.

Closes: #5004

Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

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

Thanks @jepler. Changes look good, just one question, was esp32s2 left out on purpose?
Also, I am not sure if this is related to #5004.

@jepler
Copy link
Author

jepler commented Aug 18, 2021

No, I really do believe this is the fix for #5004. I'll check esp32-s2 and of course get the build fixed.

@microdev1
Copy link
Collaborator

Also, I am not sure if this is related to #5004.

The reason why I came to that conclusion is because the issue author listed code.py as empty.
I don't mind closing the issue now as it can always be re-opened later if the issue persists.

@jepler
Copy link
Author

jepler commented Aug 19, 2021

issue author listed code.py as empty.

I overlooked this detail. perhaps there are two problems, then.

@jepler jepler requested a review from microdev1 August 19, 2021 18:55
Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@dhalbert
Copy link
Collaborator

@jepler Fine to merge?

@microdev1 microdev1 merged commit 7a0f8ae into adafruit:main Aug 20, 2021
@jepler jepler deleted the canio-timeout branch November 3, 2021 21:09
@Chad-Krause
Copy link

How does this code work? Does it use asyncio? Is there an example I can see?

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 this pull request may close these issues.

7.0.0-Alpha.4 (2021-07-15) can't boot on Feather STM32F405 Express.
4 participants