Espruino 2v00 released!

Posted on
  • Finally there's a new Espruino release - and it's a big one!

    https://www.youtube.com/watch?v=YQtLmu8-­aHw

    Highlights

    • Getter and Setter support
    • for(var i of array) to iterate over elements
    • More ES6 API functions including Array.find, String.startsWith/endsWith/includes/repeat
    • Bluetooth LE boards now communicate over twice as fast, while going into an idle mode when not used and drawing significantly less power when connected.
    • Software Serial Transmit and Receive on any pin
    • Better vector font rendering
    • New Graphics improvements, including createImage for easy, readable 1bpp bitmaps, and .dump to output a copy of the current Graphics object as an image in the Web IDE console.
    • Lots of fixes, and extra checks added based on code fuzzing performed by a few different groups.
    • Improved Espruino API reference in many areas
    • You can now add extra code to be executed at boot as .boot0/1/2/3 in Storage
    • heatshrink library allows access to Espruino's built-in LZSS compression engine from JS
    • Doubled the IO buffer size on many boards (so FIFO_FULL errors are far less likely)
    • E.mapInPlace is now extremely powerful for quickly packing/unpacking bits in arrays

    Full Changes

    ES5/ES6 features

    Check current state at http://www.espruino.com/Features

    • Allow for..in to iterate over prototype chains down from Array and Object
    • Add for(var i of array) to iterate over elements
    • Added getter and setter support
    • Add missing ArrayBufferView.filter
    • Added Array.find and findIndex (also for ArrayBufferViews)
    • Added String.startsWith/endsWith/includes (#1302)
    • Added ES6 String.prototype.repeat

    Performance/Features

    • Added support for Software Serial ports (for low baud rates, eg. 9600)
    • Add extra ReferenceError checks, even if variable is not used
    • Now check for ReferenceErrors in global scope
    • Stop parsing blocks if not executing (fix #572)
    • Switch to non-recursive StringExt copy (fix #1451)
    • Add E.lookupNoCase to allow searching case-insensitively for Object keys
    • edit() now chooses the shortest way to describe the function
    • Added Global isFinite
    • Enable E.setTimeZone on boards with very little flash memory
    • Reconstruct start and end newlines when dumping multi-line functions
    • Add Ethernet.getIP/setIP callbacks for Wiznet to bring them in line with WiFi (fix #1482)
    • Console now doesn't print quotes around object keys if it's not needed
    • Added E.toJS to allow very compact JS data stringification (similar to JSON.stringify for JSON2)
    • Output the current timer number as a comment in dump()
    • Don't print =undefined to console if line is empty
    • Use 32 bit floats for E.FFT, not 64 (fix #1443)
    • Automatically shut down UART if both pin states are changed
    • Added non-standard Uint24Array, because it's very useful for RGB
    • Allow btoa to work for arrays as well as Strings (fix #1509)
    • Improve E.mapInPlace docs, and allow it to work with no map (eg pass straight through)
    • Allow E.mapInPlace to merge bits from multiple source elements, also add option for msb/lsb first
    • Double IO buffer size to 256 (1k bytes) on boards with 96k of RAM or more (or NRF52)
    • Add 'bits' option for Software SPI
    • STM32 reset pin IRQs before storing the state - makes lost setWatches far less likely

    Graphics

    • Pixl.js menu now resets font alignment, and down arrow icon is fixed
    • Added Graphics.asBMP/asURL/dump - allowing easy debugging of Graphics via IDE
    • Added Graphics.drawPoly
    • Fix rounding errors in fillPoly -> improve vector font rendering
    • Graphics.stringWidth now takes account of newlines
    • Add Graphics.asImage to turn a Graphics instance into an Image that can be used with drawImage
    • Add Graphics.createImage to allow creation of a 1 bit image direct from a string

    Flash Memory

    • Added Storage.getFree() to return available space
    • Check Flash Storage for modules when using require
    • Added 'heatshrink' library to expose built-in heatshrink compression
    • Search for and execute files '.boot0'/1/2/3 in Storage at boot time if they exist

    Bluetooth Boards

    • Add options argument to NRF.connect and BluetoothDevice.gatt.connect, allowing a connection interval to be specified
    • Start renegotiating speed after 0.1ms, not 5s. Massively improves connect speed.
    • Add Dynamic Interval Adjustment - default to 2x connection speed, but idle at 10x slower if not used for 2 minutes
    • Add NRF.setConnectionInterval() to allow connection speed to be set manually
    • NRF.requestDevice now resolves as soon as a device is found. Faster and better in congested areas
    • increase JsSysTime accuracy to 2^-20 from 2^-16 - drastically improves Util Timer accuracy
    • Add Pixl.setLCDPower to allow the LCD to be powered off, more than halving power consumption
    • Allow NRF.setScan and NRF.findDevices to take the same search filters NRF.requestDevice does (fix #1496)
    • allow arbirtary baud rates to be specified for UART
    • Added NRF.HID event for two-way BLE HID communications
    • Pixl.js: Fix 30s pause when closing sockets on WIZnet W5100 (fix #1306)
    • MDBT42Q: Add LED2 var in the Espruino interpreter, but don't use it for the bootloader

  • Other boards

    • RuuviTag: invert LED1, LED2 & BTN in software so LED.set() does what you'd expect
    • Added RAK8212 (and include SMS/GPRS code in RAK8211/2 builds)
    • Increase size of saved code area from 3*4k to 10*4k on RAK821x boards
    • ESP8266: add CFLAGs to shrink binary files (fix #1499)
    • ESP8266: fully integration of analog pin A0 (fix #1495)
    • ESP32: update sdk to esp-idf 3.0.1, set Espruino build tools back to master branch
    • ESP8266: release heap used by logDebug(true) (fix #1508)
    • ESP8266: remove SHA256 SHA512 (fix #1517)
    • ESP8266: switch to SDK 2.2.1 (fix #1207)

    Fixes

    • changeInterval now works with large (>32 bit) intervals (fix #1438)
    • changeInterval now changes the interval immediately when it's called inside the interval it is changing (fix #1440)
    • Fix parsing of try..catch when not executing (fix #1439)
    • Allow Ctrl-C out of while...continue loop (fix #1441)
    • Fix bug if using an undefined member of an object for for..in (fix #1437)
    • Fix stack overflow if interpreting a file full of '{' (fix #1448)
    • Fix exception when performing record access on object from getter (fix #1454)
    • Fix issue that caused 'dump()' not to report variables/functions on Pixl.js
    • Fix HTTP Chunked transfers when the server uses lowercase headers (fix #1458)
    • Fix TypedArray.indexOf (fix #1468)
    • Allow require('Storage').write('a','',0,15) (zero length data) (fix #1465)
    • Fixed bug when RegExp.match/test called on non-strings
    • Fix unreliable ArrayBufferView.indexOf (#1468)
    • parseFloat(".s") now returns NaN
    • Fixed /\S+/.test(" ")
    • Allow '.then' on already-resolved promise (fix #1476)
    • Stop atob adding trailing 0s when strings are not a multiple of 3 long
    • Fix Array.shift (returned a NAME, rather than the value)
    • Stop characters getting dropped when pasting large amounts of data into Linux build
    • Fix Math.round for numbers > 32 bit (fix #1485)
    • Fix JS state restoration issue (eg. Pixl.menu inside switch would cause errors)
    • Fix setDeviceClockCmd: Unknown Device when using LoopbackB.setConsole() on WiFi board
    • Fix buffer overrun if we have to reallocate a pointer to argument lists when calling a function (fix #1491)
    • Fix stack overflow if executing regex full of hundreds of open brackets (fix #1487)
    • Fix issue where STM32F4 USB could lock up if TX during heavy RX
    • Fix 'Can't extend undefined' when using Object.setPrototypeOf on a function
    • Fixed hang if trying to allocate Storage greater than total storage size in a fully erased Storage area.
    • Fix assert fail when calling Function.apply with an Object with non-numeric keys
    • Fix issue when AT lib has to process multiple custom line handers in one packet
    • Espruino WiFi: Fix unreliable send when receiving lots of data on another socket
    • Espruino WiFi: Only rename EspruinoWiFi to WiFi if not found (allows easier debug)
    • Ensure that setBusyIndicator updates output state after the very first initialisation.
    • Ensure Date.getTimezoneOffset() returns the correct timezone offset (fix #1515)

    Features lost

    Unfortunately with all this work I've had to spend a lot of time stripping things back to keep Espruino building on the more constrained platforms. These changes have been made carefully to try and remove features that people weren't using anyway.

    • Lower saved code area to 2k on micro:bit (from 3)
    • Remove RGB colour handling in setColor on devices with low flash
    • Reduce available variable count on STM32VL - we were too low on RAM
    • Remove Graphics.scroll/drawCircle/fillCircle on devices with low flash to allow builds to fit again
    • On devices with low flash, ensure atan2 uses the slower/smaller atan implementation
    • Move FFT back to 64 bit if low flash (it uses less memory!) and optimise for flash space
    • Remove Olimexino from build (too difficult to slim down build and very low usage)
    • Remove HASH/hashlib from all builds as it was confusingly in some and not others. Now use 'crypto'
    • require('crypto').SHA1 is now JS in Espruino Original to cut down on the flash required
    • Pixl.js: reduce saved code area to 9 x 4kb to allow for extra features
    • microbit: remove line-by-line debug capability to free up some space
  • WoW
    Exciting

  • Wow wow wow! :-P

  • A LOT to take in... and I like very much the 2 as begin of version number.

    I'm a little curious about the behavior of these two items

    • Add extra ReferenceError checks, even if variable is not used
    • Now check for ReferenceErrors in global scope

    If the check stops execution before a check in the application for typeof == "undefined"code happens, some applications will have to change.

    As with all things software/firmware, I can see that more constraint platforms can get stuck on a maintenance version/branch rather the evolutionary one. Yes, it is to regret... but picking a too 'small' device shout be regretted more than put just too much work into retrofitting the 'past'.

    A statistics about module requests from http://www.espruino.com/modules by devices can help with the selection which devices have to switch such a maintenance version/branch. Getting to know how custom firmware builds are done by individual users and developers and how features can be removed/added beyond the already available options is still an option to bring such devices on per-application basis into the 'present'.

  • I'm not sure I understand what you mean?

    About ReferenceErrors: In 1v99 you could write foo,12 where foo was undefined - and nothing would happen. Now you get a ReferenceError. It won't be stopping anything from working, it just helps to find bugs earlier. typeof still works as you'd expect.

  • Ic. foo.xy has - as expected - to fail when foo is undefined - and it obviously did not pre 2v00; but I expect foo.xy and foo["xy"] to return undefined with foo defined and xy in foo undefined or having the value undefined and being interpreted as falsy in an conditional expression (foo.xy) or (foo["xy"]). I assume all is just fine - have to fix my 'paranoia'... ;-) - Will do that with some validation and bringing my understanding up to date.

  • Fantastic news. Flashing it now on to a Pixl!

  • Great work as always, Gordon!

  • Long way well travelled. Congrats.

  • Found it much more stable than 1.97 regarding noisy button debouncing.

    And a small bug in the debugger; statement. First 'n' I press echoes twice.

  • Great!

    And a small bug in the debugger; statement. First 'n' I press echoes twice.

    Can you start a new thread for that? Just tried it here on a Pixl and it seems fine.

  • nice !

    especially the graphics & storage stuff ;)

    keep it up :)

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

Espruino 2v00 released!

Posted by Avatar for Gordon @Gordon

Actions