Closed todbot closed 4 years ago
I also face a similar problem. I am using a Seeeduino Xiao board. When using the latest CircuitPython 6.0.0 Beta 2 the program does not autoload when saving. Any program, even the blink program does not run on save. I have to disconnect and reconnect the board in order for the program to run. When using CircuitPython 5.3.1 everything works as expected.
Anyone tried this on an M0 Express board?
I just tried this on an M0 Basic (and just changed the print as no neopixel) and saw the exact same behavior. Hitting Ctrl-S in Mu did not auto-reload. Ctrl-C & Ctrl-D reloaded it.
Ok, I suspect that this is an interaction with the time.sleep and the autoreload timing.
ahh, yes! If I create a similar small script, but do not use time.sleep()
, auto-reload works fine. E.g.
import board
import time
import neopixel
from random import randint
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
lasttime = time.monotonic()
while True:
if time.monotonic() - lasttime > 0.2:
lasttime=time.monotonic()
print(time.monotonic(), "hello")
pixel.fill( (randint(0,255), randint(0,255), randint(0,255) ))
Verified on Trinket M0 that #3532 fixes auto-reload.
Host PC: Macbook Pro running macOS 10.15.7 Board: QT Py, with no peripherals (also happens on Trinket M0) CircuitPython version: 6-beta2
I've been noticing in CircuitPython 6 that the auto-reload doesn't seem to work much after saving a file. For instance, in the CP program below (which plays random colors on the built-in Neopixel and prints out the current
time.monotonic()
and a string), I can edit the "hello" string, save the file, and auto-reload does not happen.Here's a screencast showing what I'm seeing.
(also at https://imgur.com/gallery/zAHgrNg)
In the screencast, there are two terminals: the bottom one shows the output of CP's USB Serial, in the top one I use
vim
to editcode.py
, save it, and quit the editor. In the serial terminal, nothing changes, until I Ctrl-C and Ctrl-D to stop & restart execution.