Can't make board work after unplug/reset.

Posted on
  • Just received my board. While I was playing inside WebIDE everything was fine. Until I tried to run my board "off the grid". So, what I did.

    I've updated my v43 firmware to v48 using WebIDE. Wrote small program to blink LEDs:­404f69683c203
    (Initially it was w/o button code)
    So, I put this code into right panel, click "Send to Espruino", switched to left panel, typed "save();" hit enter.

    After my Arduino background I expected that if I unplug USB cable, go to my friends PC, and plug it in, program will start from beginning. But it doesn't happen. Obviously, there is some error in my workflow, but I can't figure out what am I doing incorrectly.

  • Actually, I was unable to take "off the grid" also this example:­+Button (last code block)

  • I have the same problem, simple to reproduce.

    reset the board, an add this code "setInterval("digitalWrite(LED1,l=!l);",­200);"
    dump shows then:

    var l = false;
    setInterval("digitalWrite(LED1,l=!l);", 200);

    after "save();" and a reboot I got this code:

    var l = true;

  • strange. Can anyone else reproduce this? I just tried with 1v48 for the website and it works fine.


    What Dorantor is seeing might be to do with the fact that it's plugged into a PC. Could you try just plugging into a USB wall socket? (or even just starting a terminal app).

    The problem is this: When Espruino isn't plugged into a computer, it knows and every time it wants to write something to the console (like the welcome message) it just throws it away because it knows nobody is listening.

    However when you're plugged into a computer it knows it is connected, and it waits patiently trying to send data but because there is no terminal app open on the computer, the computer isn't accepting it.

    It's a bit difficult, because in some cases it would be really annoying if Espruino just 'lost' data that you'd tried to output. I'll try and tweak it so that at least the welcome message doesn't stop it from working.

  • If I connect board to a USB wall socket - everything works fine. So, you're right about the roots of this issue.
    From my point of view, it would be nice if I could switch Espruino between two states: throw away, even if somebody listening; wait until somebody takes the data(current behavior). And it would be good to be able to control this from program.

  • Yesterday I made some changes (that'll be in the next Espruino version) so that the output buffer is a bit bigger, and if Espruino loads from flash it doesn't output the Espruino logo.

    That means that your problem will go away, but that if you do:

    var l = false;
    setInterval("digitalWrite(LED1,l=!l);con­sole.log('foo')", 200);

    Then Espruino will still stop working after a while. I'm planning to do some work on flow control with the USART, so hopefully I'll roll an option for setting USB flow control into those changes.

  • With firmware v50 the problem losing code is solved for me. Thanks!

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

Can't make board work after unplug/reset.

Posted by Avatar for Dorantor @Dorantor