Call `reset()` before uploading code

Posted on
  • Probably another of my edge cases, but if I have an Interval set in my code of about 100ms or so, and then try to upload new code to my Espruino WiFi I can quite often get the Espruino and the IDE stuck, the upload progress bar is about 1/16th in, the Espruino is otherwise unresponsive and I have to unplug and replug.

    However if I connect, run reset() and then upload new code, everything works.

    Could the code upload function run reset() by itself? Or otherwise interrupt the running program before it tries to upload?

  • Huh, just found this but its already ticked.

    1 Attachment

    • Screen Shot 2017-07-24 at 09.51.56.png
  • That's strange - and you running with Save on send turned on, or off (the default)?

    The IDE actually does run a reset() before upload - unless it's been turned off? Try checking settings -> communications -> reset before send. If that's off it could cause all kinds of problems!

    I guess perhaps the code you've uploaded has functions that take a long time to execute... Espruino usually gives it ~250ms to reset, but if your function runs for a full second before leaving then it's possible the Wifi board won't have reset by the time code starts getting uploaded.

    The IDE also tries to send Ctrl-C if it's not getting a response, which should help to break out of whatever is running... You could try doing that manually and seeing if it helps after the board has become unresponsive

  • Beat me to it! You can check in the 'console' menu item as well, and you should hopefully see it mentions reset() being sent.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Call `reset()` before uploading code

Posted by Avatar for dave_irvine @dave_irvine