Any way to configure timeout for Upload-Monitor?

Every time I try Upload-Monitor, after upload the monitor command says it can’t find a port (macOS Sierra talking to Adafruit Feather M0). I’m guessing the reboot/reconnect is taking too long.

Is there a way to extend the timeout on finding a port or add a delay before trying?

If I configure the port on the command (losing the convenience of auto port finding) should I expect that to wait longer?

Thanks.

  • Frank
1 Like

I had the same problem and fixed it by adding the following line to platformio.ini (below the [env: ] line:

extra_scripts = post:extra_script.py

Then adding a file named extra_script.py in the same folder as platformio.ini containing:

Import("env")

def after_upload(source, target, env):
    print "Delay while uploading..."
    import time
    time.sleep(2)
    print "Done!"

env.AddPostAction("upload", after_upload)

The amount of time to wait is specified in the time.sleep(x) command, 2 seconds worked for a Teensy 3.6 project that’s about 300k of downloaded data. You can adjust as needed.

6 Likes

Thanks, @rubillos! That worked perfectly. I put the script in my ~/bin directory so that I can use it will all my projects.

Cheers,

  • Frank

I’ve been having this problem for months. I thought I was frying boards by uploading too fast and couldn’t get windows to detect the right port. I don’t know if this is the solution but I’m happy to try it.

I’ve been getting awful superstitious about how I connect and in what order I open software or com ports. Intermittent problems are the worst. I’m running windows10 and hate the way it holds onto vid/pid/driver info even if it’s been deleted, uninstalled, reboot, delete host controller, say the magic words etc…