This one's a massive release - containing a whole raft of improvements that were originally developed for Puck.js - which will be going into production early next week!
You can check out a full list of improvements here but in summary - and with a bit more info:
ES6 additions
ES6 Template Literals - the following kind of stuff now works, so could really tidy up service webpages:
for (var i=0;i<5;i++)
console.log(`No.${i} Hello World, even ${i*0.25}`);
ES6 Arrow Functions - this'll keep a lot of JS developers happy too. For instance:
[5,6,7,8].map(x=>x/2)
// or
["Foo", "Bar", "Baz"].filter(a=>a[1]=="a")
// or
[5,6,7,8].sort((a,b)=>b-a)
Promises now work pretty well too, and are used in Puck.js's BLE Central Mode API. Chaining works great, as does catching exceptions thrown inside promises. They even work with arrow functions:
new Promise((resolve,reject) => { resolve("Wohoo!"); }).then(
a => { console.log(a); });
(Sadly none of the above made it to the micro:bit, as it's just too short on Flash/RAM at the moment. They're in the Original Espruino, Pico, Wifi, and Puck.js though)
Improvements
Tab complete now offers a much better set of completions, and spaces them out nicely if they're too long
Add 'opendrain_pullup' pinMode (including emulation on STM32F1)
Make OneWire use opendrain_pullup (so no resistor is needed for short runs on OneWire now)
Add Software I2C (with opendrain_pullup, so it doesn't even need resistors)
Tweak VGA output back porch to 2ms (so leftmost pixels always on screen)
Added E.lockConsole() for use with E.setPassword()
Allow padding to be specified as 3rd argument of JSON.stringify
JSON.stringify now dumps typed arrays as arrays - while not according to the spec, this can be really helpful
Add Third option to pinMode to allow the pin mode to be set while keeping it 'unforced'
save() and dump() now keep track of whether pin mode had been forced or not
fs.readFile (and File.read) now use Flat Strings to allow more memory efficient reads
LED + BTN definitions now autocomplete
Loads of fixes/improvements to the BBC micro:bit's BLE
Some internal variables are now freed if they're undefined (saving memory)
Console now prints the type of Objects if their constructor is in the root scope - eg new Bob() => "Bob {}"
Exceptions now ave a 'stack' attribute if they can have children. This means you can use process.on(uncaughtException, ...) to catch exceptions along with the exact place in code that they happened
Ctrl-C on micro:bit now works great - and breaks out of execution
Fixes
Fix emitting of events with long names
Ensure 'af_opendrain' pin mode gets remembered when saving
Fixed memory leak when automatically converting a simple object to a String
Cope with new escape codes for home and end on Ubuntu 16.04 (27,91,70/72)
Fix 2 concurrent waveforms on different pins
Fix STM32 regression where pinMode was set when it shouldn't have been
Fix Espruino WiFi's timing issues (also applies to F4 with added LSI crystal)
When moving console before printing has started, move all buffer contents as well
Fix regression where replacing a function starting with 'return' with another would cause errors
Fix switch fall-through to default
Added E.dumpLockedVars() in non-release builds to help debug memory leaks in libraries
So loads of stuff... Sadly I had to remove the VGA/TV output from the Original Espruino to make room for it. It's still in Pico/WiFi boards though - let me know if you were using it on the Original board and I'll see what I can do to get it back in (however I don't think it has ever been used!).
There'll also be a new Web IDE release coming soon too.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
This one's a massive release - containing a whole raft of improvements that were originally developed for Puck.js - which will be going into production early next week!
You can check out a full list of improvements here but in summary - and with a bit more info:
ES6 additions
ES6 Template Literals - the following kind of stuff now works, so could really tidy up service webpages:
ES6 Arrow Functions - this'll keep a lot of JS developers happy too. For instance:
Promises now work pretty well too, and are used in Puck.js's BLE Central Mode API. Chaining works great, as does catching exceptions thrown inside promises. They even work with arrow functions:
(Sadly none of the above made it to the micro:bit, as it's just too short on Flash/RAM at the moment. They're in the Original Espruino, Pico, Wifi, and Puck.js though)
Improvements
opendrain_pullup
(so no resistor is needed for short runs on OneWire now)E.lockConsole()
for use withE.setPassword()
save()
anddump()
now keep track of whether pin mode had been forced or notfs.readFile
(andFile.read
) now use Flat Strings to allow more memory efficient readsnew Bob() => "Bob {}"
process.on(
uncaughtException, ...)
to catch exceptions along with the exact place in code that they happenedFixes
E.dumpLockedVars()
in non-release builds to help debug memory leaks in librariesSo loads of stuff... Sadly I had to remove the VGA/TV output from the Original Espruino to make room for it. It's still in Pico/WiFi boards though - let me know if you were using it on the Original board and I'll see what I can do to get it back in (however I don't think it has ever been used!).
There'll also be a new Web IDE release coming soon too.