Open RetiredWizard opened 5 months ago
Oh yeah, KeyboardInterrupt (ctrl+c) and ReloadException are exceptions, so this code with a bare except
is functioning exactly as standard Python. So this is likely not a fixable bug, it's just part of how ReloadException works. However, maybe there's a spot in the documentation where this could be better explained -- https://docs.circuitpython.org/en/latest/docs/library/builtins.html#builtins.ReloadException doesn't directly mention anything for example.
One (probably not particularly high quality) stack overflow thread about it: https://stackoverflow.com/questions/54948548/what-is-wrong-with-using-a-bare-except
Okay.... If I'm remembering properly, I originally thought the issue was tightly associated with the auto-reload but then I thought I re-created it with auto-reload disabled so I was just using the auto-reload as an easy trigger to reproduce the error. When I get a chance to dig back into this, I'll have confirm the problem happens with auto-reload disabled and then see if an auto-reload is somehow being triggered even though they've been disabled or if there's another path to hanging the display.
Thanks!
CircuitPython version
Code/REPL
Behavior
Sequence of numbers are displayed on both USB serial terminal and attached display. When a file is written to the microcontroller flash the attached TFT display stops updating and serial terminal output speeds up.
Description
This was originally discovered on the Lilygo T-Deck board where the keyboard is the I2C device that was being read in a loop. When the host computer signals CircuitPython that the flash file system has been updated, no Auto-reload would occur and the display would stop updating however the I2C keyboard would continue to function and if a USB serial terminal was connected it would show the I2C keyboard input and any ongoing output. If the code.py program terminated (either normally, or by a keyboard interrupt) the auto-reload would be triggered.
When the display was in this hung state, manually releasing the display and re-initializing it from the REPL had no effect, the screen continue to show whatever was on the display at the moment it hung.
Additional information
Modifying the try/except block as follows seems to prevent the issue from occuring:
Some testing was done with auto-reload disabled and it appeared the problem could still occur although I haven't looked into what could be triggering it.
I also tested the code.py from above using a Featherwing TFT and ESP32-S3 Feather 4/2 and a stemma MSA301 sensor. I wasn't able to get the problem to happen using the released 9.0.4 version of CircuitPython with the Featherwing/MSA301 combination but it did reliably occur using the 9.1.0 beta 2 version. The code.py file does reliable produce the issue on both 9.1.0 beta 2 and 9.0.4 versions with the Lilygo T-Deck.