Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#6132 had a regression: when doing fake deep sleep, a write to CIRCUITPY waited until sleep was done instead of restarting immediately. I fixed this but still saw some flakiness.
After some cogitation, I reworked the basic logic of auto-reload. Instead of using ticks to count down a time before raising the reload exception, I raise the exception immediately, and then wait in main.c for the auto-reload delay, restarting the clock if new writes occur. auto-reload is also check in the fake/real sleep loop in main.c, as before. The new code is a little smaller.
Summary:
CIRCUITPY_AUTORELOAD_DELAY_MS
from 500 ms to 750 ms. At 500 ms I sometimes saw IOErrors or filesystem corruption, especially when using emacs, which writes backup files.supervisor/shared/autoreload.*
tosupervisor/shared/reload.*
because of the next change.py/reload.*
code tosupervisor/shared/reload.*
Tested on CPX, Feather nRF52840, MagTag, and Feather RP2040.
Basic test program (which I edited repeatedly):
Also tested with simulated deep sleep on MagTag and Feather nRF52840.
I'd be happy if others tried this too, to see if fixes #6007 for them.