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

Avoid crashing when display components are deinitialized #9568

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

jepler
Copy link
Member

@jepler jepler commented Aug 28, 2024

Now, try_lock (SPI & I2C) & begin_transaction (display bus core) will check that the related objects are still valid first; if they are not, the lock/begin transaction will fail by returning false, rather than "other things" such as raising a Python exception where it is not permitted, accessing invalid memory, etc.

I tested by running a version of the #9426 reproducer on a Raspberry Pi Pico. It was able to complete & soft reset multiple times with no error. I also made sure that basic display functionality still worked on a Feather ESP32S3 TFT (i.e., the REPL is still shown on the LCD when no code.py is present) and that the #8278 reproducer made the display stop updating but did not crash, including when soft-resetting the REPL.

I didn't test I2C or parallel bus bus types, epaper displays, framebuffer displays, etc. There may still be problems with these other display types & combinations.

Closes #8278 and Closes #9426

Now, try_lock (SPI & I2C) & begin_transaction (display bus core) will check
that the related objects are still valid first; if they are not,
the lock/begin transaction will fail by returning false, rather than
"other things" such as raising a Python exception where it is not
permitted, accessing invalid memory, etc.

Closes adafruit#8278 and Closes adafruit#9426
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks good! Unfortunately one SAMD21 board overflowed.

@jepler jepler requested a review from tannewt August 28, 2024 19:07
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you!

@tannewt tannewt merged commit 2e710be into adafruit:main Aug 28, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants