Espruino 2v05

Posted on
  • This is a truly massive one - it has been a while coming! Some massive additions though...

    It's worth noting that Bangle.js KickStarter units (and Puck.js v2 when released) shipped with a 2v05 release, which is kindof a pre-release. I couldn't release all other boards at the same
    time because of issues with increased firmwware size on some boards.

    Additions

    • Add Array.includes
    • Added Graphics.getFont/setFont/getFonts
    • Added Graphics.getFontHeight
    • Added option to compile in 6x8 fixed-width fonts
    • Added option to build in TensorFlow Lite for AI
    • nRF52: Add NRF.nfcPair(...) and OOB pairing to allow tap to pair over BLE
    • nRF52: Add NRF.nfcAndroidApp(...) to launch an Android app on touch
    • Graphics.setFont("4x6",2) will now double the size of a bitmap font
    • Graphics.drawImage can now take a String of data for an image (eg. direct from Storage)
    • require("Flash").write operations no longer need to be aligned
    • require("Storage").open added - for appendable files
    • nRF5x: Add NRF.filterDevices to allow scanned devices to be easily filtered after scanning
    • Add option to specify a palette when drawing images with drawImage
    • Add XON/XOFF flow control to Bluetooth LE UART (on by default)
    • Add a fast path for non-rotated non-scaled Graphics.drawImage
    • Add E.showMenu, deprecate Pixl.menu - use a common function to ease porting between devices
    • Added E.showPrompt, E.showAlert for Bangle.js and Pixl.js
    • Pixl.js - check '.splash' file at startup and use it for splash screen if it's there
    • Added E.defrag to perform defragmentation - still beta!
    • Flash Strings: On Bangle.js allow JS code (and other Strings) to be accessed without loading them completely from Flash
    • Allow g.setColor/setBgColor to take hex Strings of the form '#00ff00'
    • Add Graphics.toColor, and allow 4 bit Mac palette to be mapped to 8 bit web palette
    • Add Graphics.setClipRect to allow draw ops to be restricted to a certain area
    • Graphics: new g.fillPoly to handle irregular polygons
    • Graphics: drawEllipse/fillEllipse now work correctly for very small ellipses
    • Allow Storage.read to make partial file reads (fix #1744)
    • Add Graphics.reset, and ensure it (and g.clear(1)) unreference custom fonts
    • Added E.CRC32 for easy testing of data validity
    • Add E.on('kill' event for executing code before load/reset/save/etc
    • Allow optional load("filename") to load a JS file from Storage (was just load())
    • Add .toJSON handling for JSON.stringify, and add Date.toJSON (fix #1754)
    • Add Storage.writeJSON to avoid any confusion of writing arrays/numbers/etc
    • Add more info about flash memory to process.env/process.memory
    • Add Graphics.quadraticBezier()
    • Allow Graphics.setFont to be used with custom fonts (fix #1762)
    • Add E.setConsole/getConsole to allow console to be moved (including to 'null')
    • Add StorageFile.getLength() to get the current length of a StorageFile
    • Storage.list() can now take a RegEx/string to filter returned results
    • Storage.readJSON now has optional 2nd arg that stops it from creating exceptions on bad JSON
    • Add euro symbol to 6x8 and 4x6 fonts as char code 128 (ISO10646-1)
    • ESP32: add environment variable COMPORT to be used with make flash
    • Puck.js: v2 Support: Accelerometer/Gyro/temp
    • Puck.js: Self test now sets Puck.js BLE name if there's an error
    • Puck.js: Allow D21(RST) to be used as normal IO pin

    Fixes

    • Fix (Number.toFixed) rounding, eg (1234.505).toFixed(2)
    • Fix issue where Util Timer timers could break after a call to setTime
    • nRF5x: Support connection to devices with RANDOM_PRIVATE_RESOLVABLE and RANDOM_PRIVATE_NON_RESOLVABLE addresses
    • Pixl.js: Move SCK pin used during Neopixel writes to ensure it doesn't interfere with BTN3
    • nRF52: Fix alignment issue with Nordic's SDK12 code that stopped passkey pairing from working sometimes
    • nRF52: Fix 'BLE task completed that wasn't scheduled' warning regression (peripheral disconnect)
    • nRF52: fix issue where restarting the softdevice would reset the RTC (fixes Bangle.js watchdog reset)
    • nRF52: fix issue where advertising flags could get out of sync after SD restart
    • nRF52: Fix passkey pairing if setSecurity is after setServices
    • Fix pretokenise of RegExp literals (fix #1786)
    • Fixed REPL to allow chars with char code >=128
    • Fixed lex tokenToString for 'break'
    • Fix SyntaxError when using pretokenise + getters (fix #1745)
    • Ensure it's possible to get a solid background when using 4x6 font
    • Fix parseInt("0b",16) as well as some other non-compliant behaviour (fix #1722)
    • Espruino WiFi: WiFi module now makes BOOT pin open circuit when sleeping - saves ~2mA

  • Tweaks

    • nRF52: If a central is connected to Espruino but isn't reading from UART, don't block waiting to send data
    • Allow heatshrink compress/decompress to work even if flat buffers can't be allocated
    • Lower thresholds for XON/XOFF to give more headroom with devices that are slow to respond
    • nRF5x: Ensure gatt.connect silently succeeds if we're already connected to the device
    • Improve free list ordering when Flat Strings are freed
    • Added ability to compile Espruino to JavaScript with Emscripten
    • JSON.stringify now escapes using the less efficient JSON subset of escape characters (fix #1737)
    • Add append optimisation for string '+', and don't append to flat/native/etc strings (fix #1746)
    • ESP8266_4MB: add optional build flag FLASH_1MB for ESP8255 & ESP01s with 1MB flash
    • ESP8266: add optional build flag NO_FOTA to remove flash over the air functionality
    • Increase 'Storage' library's max filename size to 24 bytes (from 8)

    Removals

    • Pixl.js remove SHA512 to make room for new NFC functionality
    • Pixl.js: Removed AES functionality - unfortunately we're running low on space for it
    • Original Espruino Board: Removed Vector font and don't add rotated drawImage to save flash
    • Espruino Original: Removed Debugger, Tab complete, AT command networking from WIZnet networking build to free enough Flash
    • Espruino Pico: Added a normal build that doesn't contain CC3000 or WIZnet support
    • Espruino Pico: Removed Debugger and Vector font from WIZnet/CC3000 networking versions to free enough Flash
    • HYSTM32_28: Removed from build due to lack of interest and difficulty with increased firmware size
    • MDBT42Q: Remove AES encryption libs by default to free up more flash memory
    • Microbit: Add SAVE_ON_FLASH_EXTREME flag to ensure builds keep working

    Additions since KickStarter Build

    • Bangle.js: Add 'meridian' to locale library
    • Bangle.js: Don't load .boot0/1/2/3 if BTN1 is pressed
    • Bangle.js: Now clear entire top/bottom row if there are widgets in it (fix #1790)
    • Bangle.js: fix post-kickstarter issue adding widgets in bottom of screen (#1790)
    • Bangle.js: fix magnetometer self-calibration
    • Fix bitwise rshift by 0 to be unsigned (fix #1784)
    • Add Storage check at startup and erase everything if storage looks corrupt (fix #1766)
    • Fix restriction on StorageFile filename length (8 to 28)
    • Fix array sort when compare fn returns floats <1 (fix #1798)
    • Fix Storage.write duplicate file issue in some rare cases (fix #1801)
  • ! - all to say (speechless) - except: Tank you very much!

  • Hi Gordon,

    I have a question:

    With the previous version the following code ran correctly, but now I get an error:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v05 (c) 2019 G.Williams
    >
    Uncaught InternalError: Timeout on SPI RX
     at line 1 col 30
    b.write([33,191,20,6,32,12],d);void 0!==e&&e()
                                 ^
    in function called from system
    > 
    

    my code:

    A2.write(0); // GND
    A3.write(0); // light off
    A4.write(1); // VCC
    SPI1.setup({ baud: 1000000, sck:A5, mosi:A7 });
    
    var g;
    
    var MONTHS = [
      "Jan","Feb","Mar","Apr","May","Jun",
      "Jul","Aug","Sep","Oct","Nov","Dec"
      ];
    
    function draw() {
      g.clear();
      var t = new Date();
      var date = t.getDate()+" "+MONTHS[t.getMonth()]+" "+t.getFullYear();
      var time = t.getHours()+":" +
           ("0"+t.getMinutes()).substr(-2);
      var secs = ("0"+t.getSeconds()).substr(-2);
      // top left date
      g.setFontBitmap();
      g.drawString(date,0,0);
      // middle time
      g.setFontVector(20);
      var timeWidth = g.stringWidth(time);
      g.drawString(time,(g.getWidth()-timeWidt­h-12)/2,10);
      // seconds over to the right
      g.setFontBitmap();
      g.drawString(secs,(g.getWidth()+timeWidt­h-8)/2,26);
      // send to LCD
      g.flip();
    }
    
    function onInit() {
      clearInterval();
      // Setup SPI
      var spi = new SPI();
      // Initialise the LCD
      g = require("PCD8544").connect(SPI1,A6,B0,B1­, function() {
        // When it's initialised, set up an animation at 20fps (50ms per frame)
        setInterval(draw, 1000);
      });
    }
    
    var next_state = 1;
    function swap() {
      A3.write(next_state);
      next_state = !next_state;
    }
    
    function swap_on_down() {
      if (digitalRead(BTN1) == 1) swap();
    }
    
    setWatch(swap_on_down, BTN1, true);
    
    onInit();
    

    Do I need to adjust the code for this?

    rgds,

    Reinoud

  • That's a very odd one. Please could you post this in a new thread and let me know which board you're using?

    If you delete SPI1.setup({ baud: 1000000, sck:A5, mosi:A7 }); and then use this code:

     // Setup SPI
      var spi = new SPI();
      spi.setup({ baud: 1000000, sck:A5, mosi:A7 });
      // Initialise the LCD
      g = require("PCD8544").connect(spi,A6,B0,B1,­ function() {
    

    In your onInit function I imagine it'll fix it though.

  • maybe stupid question, but how do I start a new thread? :-)

  • I get another error now:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v05 (c) 2019 G.Williams
    >
    Uncaught Error: No vector font in this build
     at line 24 col 21
      g.setFontVector(20);
                        ^
    in function called from system
    Uncaught Error: No vector font in this build
     at line 24 col 21
      g.setFontVector(20);
                        ^
    in function called from system
    Uncaught Error: No vector font in this build
     at line 24 col 21
      g.setFontVector(20);
                        ^
    in function called from system
    Uncaught Error: No vector font in this build
     at line 24 col 21
      g.setFontVector(20);
                        ^
    in function called from system
    Uncaught Error: No vector font in this build
     at line 24 col 21
      g.setFontVector(20);
                        ^
    

    The board I'm using is an Espruino Rev. 1.3b

  • @Reinoud Have a look at post #2, section "Removal". Probably the vector fonts had to be removed due to space restrictions for your board.

  • Good point, I didn't notice that...

    I tried to flash with all features (I selected the second option here):

    But I still get the same error...

  • Ok, I tried the following:

    1. Downloaded espruino_2v04_espruino_1r3.bin and flashed, everything is ok!
    2. Downloaded espruino_2v05_espruino_1r3.bin and flashed, same error is back...

    I Guess none of the 2v05 versions have the vector font...

    I'l stick to 2v04 for a while then! :-)

    thanks and kind regards,

    Reinoud

  • Hi - yes, sorry, that was a mistake in the docs by the look of it - the vector font had to be taken out of those builds.

    I guess I could do a third build option with no networking, but the other features?

  • That would be nice! Another question; the clock seems to go a bit quicker than it should. I read somewhere that I can add a crystal which would fix that. I have a crystal lying around, is it possible to test if the crystal works correctly?

  • I've just started a new forum post at http://forum.espruino.com/conversations/­347042/ with links to info on adding crystals.

    If you've got other questions, please can you start a new post? Just go to the forum for your type of board (http://forum.espruino.com/microcosms/108­3/ for the original Espruino) then click "Post a Conversation" in the top right.

    That way other people who are searching for similar problems can find it.

  • If you've got other questions, please can you start a new post? Just go to the forum for your type of > board (http://forum.espruino.com/microcosms/108­3/ for the original Espruino) then click "Post a > Conversation" in the top right.

    Got it! Thanks! :-)

  • I guess I could do a third build option with no networking, but the other features?

    Do you want me to start a new thread for this too or are you already working on it?

  • No, that's already done - so the next release will have a separate build in it. In fact the 'cutting edge' builds from http://www.espruino.com/binaries/travis/­master/ now no longer have networking but do have vector fonts, so they'd work for you.

  • Just a note that hardware SPI write is now fixed on the cutting edge builds too. The fix will be in the 2v06 release

  • very good! thanks!

  • No, that's already done - so the next release will have a separate build in it. In fact the 'cutting edge' builds from http://www.espruino.com/binaries/travis/­master/ now no longer have networking but do have vector fonts, so they'd work for you.

    Is that this one: espruino_2v05.47_espruino_1r3.bin

  • Seems to work:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v05.47 (c) 2019 G.Williams
    >
    >function getClockSource() {
    :  return ["NONE","LSE","LSI","HSE"][((peek32(0x40­021020)&768)>>8)];
    :}
    =function () { ... }
    >getClockSource();
    ="LSE"
    > 
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino 2v05

Posted by Avatar for Gordon @Gordon

Actions