You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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.

About

Avatar for Gordon @Gordon started