• The problem is that usually there won't be errors, but you can write code that always causes problems. For instance:

    for (var i=0;i<10000;i++);
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    "LotsOfDataLotsOfDataLotsOfDataLotsOfDat­aLotsOfDataLotsOfDataLotsOfData";
    

    So in that case, you're writing code that is executed immediately, so it stalls Espruino. Unfortunately the strings of text keep getting sent to it and it just can't handle them.

    Even with error checking, it won't fix the problem because it will always lose data.

    If you're doing something like that then you can easily fix it by doing:

    function doStuff() {
     // stuff that takes a while
    }
    ....
    
    // at end of file
    setTimeout(doStuff,10);
    

    Often the issue is that instead of user code causing problems, you're actually waiting for modules to load.

    I actually added software flow control at the end of last week, but it turns out Chrome doesn't support it (it only supports hardware flow control) which makes life a bit difficult. Actual hardware flow control would be great, but ST's USB code for the chip has some bugs which seem to make it non-trivial.

About

Avatar for Gordon @Gordon started