Espruino 1v60 Release (and Web IDE)

Posted on
  • I don't normally make much of a fuss when a new Espruino version is released, but I think this one's worth it... There are some massive changes!

    Referencing built-in functions

    Espruino's main issue with JS compatibility has been that built-in functions didn't exist in the Symbol Table (there's not enough RAM) and so couldn't be referenced. I've put a massive amount of effort into this over the past few weeks, and you can now reference them even though they're still kept out of RAM.

    You can now do things like this:

    [1,2,3,4].forEach(console.log)
    

    Web IDE

    @mattbrailsford has spent a lot of time making the Web IDE a lot more user friendly, and I've re-written big chunks of it to make it more maintainable and approachable.

    There are a bunch of new features, including:

    'Send to Web IDE'

    You might see a small Espruino icon in the bottom-right of code snippets on the Espruino website now. If you click this, it'll automatically open the Web IDE and will load the code right into it - so you can start playing with example code without even having to copy + paste!

    Inline Assembler

    Espruino can now dynamically create a function that executes code at an arbitrary address. To take advantage of this I've added a simple assembler to the Web IDE. It means you can now write things like this in the code editor pane:

    var adder = E.asm("long(long)",
    "movs    r2, #3",
    "movs    r3, #0",
    "adds    r0, r0, r2",
    "adc.w   r1, r1, r3",
    "bx  lr");
    

    and can then use them like any other function:

    >adder(2)
    =5
    >[1,2,3,4,5].map(adder)
    =[4,5,6,7,8]
    

    Note: The assembler only handles a handful of operations at the moment. contributions would be hugely appreciated!

    JavaScript compatibility

    I've put a bunch of work into this - tweaks to the equality tests, ArrayBuffers, rounding, and addition of things like Object.valueOf should make Espruino an awful lot more compatible now.

    WIZnet W5500 DHCP + DNS

    This makes the WIZnet module properly usable - It's both fast and stable. It can't get coexist with the CC3000 yet so you'll have to flash a special binary - see http://www.espruino.com/WIZnet

    Software SPI

    It used to be that you used SPI like this:

    SPI1.setup({ sck:B3, miso:B4, mosi:B5 });
    SPI1.send([1,2,3,4]);
    

    You can still do this, but if you don't have SPI on the pins where you want it, simply do:

    var mySPI = new SPI();
    mySPI.setup({ sck:B6, mosi:B7 });
    mySPI.send([1,2,3,4]);
    

    This will work on any pins, and can even be used with Espruino's modules, to (for instance) control an SPI LCD display when you're using the existing SPI devices for other things!


    The changelog is here and you can update directly from the Web IDE.

  • More details on inline assembler here: http://www.espruino.com/Assembler

  • Glad I could help on my part, but that's some awesome work on all the code changes. Keep up the good work! :)

  • Great work Gordon! Can't wait to try it out.

  • This is one hell of an exciting update! Awesome, can't wait to try it out tonight. Glad to see my custom font issue is fixed, just hours after I reported it :-)

    How do you use DHCP with Wiz550io?
    The new reference for Ethernet.setIP() doesn't mention it - does it just use it by default now?

    function Ethernet.setIP
    
    (top)
    Call type:
    function Ethernet.setIP(options)
    
    Description
    Set the current IP address
    
    Parameters
    options Object containing IP address options { ip : '1,2,3,4', subnet, gateway, dns }
    
    Returns
    True on success
    
  • Hi Gordon,

    Congratulations Gorden, Matt, Juergen, the WebIDE looks realy good.
    I had to enable communication throttle, not a new problem.
    When i enable minify, the code will not be uploaded at all.
    The Ascii Art is showing but never "sending".

    Sacha

  • In the old IDE we saw to what COM port we are connected. If you have more than one Espruino connected at the same time, this feature was great. BTW multiconnection would be great. I wish we had "tabs" on the left side for each connected espruino.

    EDIT: I now see the com port note "connected to port COMX". Maybe i did not saw this, sorry.
    EDIT2: It will be overwritten, after uploading code.

    Sacha

  • Another small but nice feature from the old IDE was the "reload" source code button. If i changed the code in an external editor, it was reloaded that way pretty fast.

    What makes it very hard, is that reloading the same file does not update it at all !
    I have to load a different file and switch back to the first one to force a reload.

    Sacha

  • Also related to the above (should we open a new thread for IDE related stuff?), I can't seem to find the "projects" feature anywhere? Was it removed? Is there a suggested pattern for working with bigger projects which have their own modules? Thanks, it looks fantastic :)

  • @DrAzzy: Just use eth.setIP() without arguments. I'll update the docs :)

    @Sacha: Good points - can you post these on the Web IDE issue tracker and we'll try and get them sorted.

    @gadicc: Yes, projects is gone for now. @JumJum's been working on re-adding it though.

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

Espruino 1v60 Release (and Web IDE)

Posted by Avatar for Gordon @Gordon

Actions