You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • There's a big discussion about this on GitHub where I give the reasons for this - I've already changed the documentation for console.log and it'll be in 1v62's reference - although it's been in the troubleshooting page since it existed :)

    The issue doesn't exist for Serial devices, it's just USB.

    On USB there's flow control, so if the computer is connected but isn't reading, Espruino can't write. AFAIK there's no way to tell the difference between a computer that's not looking at the serial port, and one that is looking but is too busy to read character data. Arduino may lose character data if your PC isn't reading it fast enough but IMO that's really bad behaviour and we shouldn't copy it.

    It's not such an issue for normal Arduino, where you're limited to 38400 baud (or whatever the link to the FTDI chip usually is), but on Espruino it's pretty easy to send a lot of data over USB very quickly, and it's entirely likely that it will spend time waiting for the PC to read it, so would then throw that data away when it shouldn't.

    Sure, you could detect if it sat waiting for ~1 sec and throw the data away, but having your software inexplicably stop working for 1 second and then start working is pretty bad behaviour which people would complain about too.

    Anyway, I've spent ages trying to explain the pros and cons on the bug linked above...

About

Avatar for Gordon @Gordon started