You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • This one's been a while coming too, but there are some great features:

    ReferenceError

    ReferenceError is an error that now occurs when you use a variable before it has been defined. It's a standard part of JavaScript, but it may cause you problems if you're trying to upload code that worked on 1v80.

    All you need to do to fix it is to define variables before you use them with var myVariable. It's really worth it though - it'll make it far more likely that you'll find any bugs in your code.

    Better Ctrl-C behaviour

    Ctrl-C actually does useful things now - for instance if you do setInterval("a £%^& error",10) you'll get your console full of error messages... But now, if you hit Ctrl-C, the offending interval will automatically get removed!

    Pico Power consumption

    With deep sleep turned on, Pico power consumption is now down to 20uA!

    Software PWM

    You can now do PWM on all pins, including the LEDs.

    You just have to explicitly enable it with analogWrite(LED1,0.1, {soft:true}).

    BUILT IN DEBUGGER

    Yep, Espruino now has a built in GDB-stytle debugger. For instance you can run:

    while(1) { LED2.set();LED2.reset(); }
    

    And can then press Ctrl-C and you'll enter the debugger, where you can step through statement by statement!

    See http://www.espruino.com/Debugger for more information.

    E.dumpStr()

    This is like dump() but it dumps the state of the interpreter to a String - so for instance you can now take that string and write it to a file or send it over the internet!

    pin.getInfo() and Serial/SPI/I2C.find(pin)

    This allows you to get more information about pins out of Espruino. For instance do you want to know LED2's output register address? try:

    poke32(LED2.getInfo().out_addr, 1);
    

    Or maybe you want to find out what SPI port is on B15? SPI.find(B15)

    E.on('init', ...)

    It used to be that if you wanted to run something when Espruino started, you had to make a function called onInit. Now, you can write several different init handlers:

    E.on('init', function() {
      console.log("Hello World!");
    })
    

    While it's slightly more fiddly, it means you can now copy and paste multiple bits of code, and their init handlers won't overwrite each other. For instance modules can now add init handlers, so things like LCDs could even auto-initialise themselves.


    And there's plenty more too - More specific info in the ChangeLog

About

Avatar for Gordon @Gordon started