Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Oct 2019

Most recent activity

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    Good news about no getErrorFlags - that means Espruino is pretty sure it's relayed all data it gets from the Bluetooth stack to the application.

    the application does receive all 59 packet notifications

    Not sure I understand here... By application you mean Espruino? So you do get the correct number of callbacks, just not with the right data in them?

    Is it just packets 2/3/4 that appear to be wrong, or are all the rest of them wrong?

    Do you know exactly what data you should be receiving or if there are certain bytes that definitely don't change in each packet? It might be we can see if the packets are getting combined somehow.

    If you have an NRF DK then you should be able to put it into a wireshark mode where you can see what data is being sent over the air.

    The way Espruino works internally is it shoves all the bluetooth events into a queue. So the event sits in that queue with its data, and then events are processed in sequence. I've just checked through the code again and it's extremely hard to see how they could get muddled up .

    Do you have any thoughts about how I might be able to reproduce it here?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    That's great! Thanks for the update!

    Do you remember what the changes were? Just setConnectionInterval?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    remove the console.log statements from the receiving

    In your example code I'd have said that was almost certainly the problem.

    Can you run E.getErrorFlags() and see if it says anything? If data has been arriving faster than Espruino can process it, there should be a FIFO_FULL flag.

    Could you maybe try using the extra arguments to http://www.espruino.com/Reference#l_Blue­toothRemoteGATTServer_connect to force the device to use a lower connection interval, just in case that's the problem?

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Hi - I think it might be best to start out from some existing SPI code like http://www.espruino.com/SPI and work from there...

    The code you've written seems to have a few issues (like :integer= not being valid JS) and I think you'll be banging your head against a wall for quite some time just trying to stop it erroring.

    For SPI, the issue is you're using SPI which is the class name for an SPI peripheral, but isn't an SPI peripheral itself. Try changing it for SPI1 - the first SPI peripheral - and it should be fine.

    In terms of your other stuff - try using the search box at the top right of Espruino.com and specifically the reference at http://www.espruino.com/Reference:

    function to convert decimal to binary

    If you want to convert a number to a binary string, just use ...toString(2) - eg (42).toString(2)

    ... but you don't need to convert anything to binary to send it over SPI

    fopen,fclose -- (file open, file write, file close)

    http://www.espruino.com/Reference#fs

    http://www.espruino.com/File+IO

    Or since you don't have an SD card, http://www.espruino.com/Reference#Storag­e

    getTime

    It's literally a function called 'getTime()' - or you can use Date.now() - http://www.espruino.com/Reference#l__glo­bal_getTime

  • in Electronics
    Avatar for Gordon

    I've had a play around with it. The stick on foot is ok for detecting black lines on white/etc, but it's really not that great at other stuff. So you are actually trying to use it as a mouse?

    If so - and this is obviously a bit frustrating - you could just use the lens from an old optical mouse? AFAIK they also have a neat little bit in the side which lets an LED side-illuminate what it's looking at so bumps show up more.

    Another option is if you can get a mouse that you can make output PS/2 rather than USB (some do it, or you might find an old mouse) they're pretty easy to connect to Espruino 2v0+ as you can use setWatch(...,clkPin,{data:dataPin})

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Hi - yes, the Pico is fine with up to 16v because of the onboard regulator. It'll be drawing under 40mA as long as you're not powering anything else from the 3.3v line, so the regulator is unlikely to have any problems at 12v.

    As @allObjects says if you're planning on hanging other stuff on the 3.3v line that brings it up to near the regulator's 250mA limit (like an ESP8266 WiFi) then you might want to consider a regulator to bring the volts down to 5v so the poor regulator doesn't heat it too much. It has overtemperature protection, but it might cause the Pico to reboot :)

    Just a note though: You can power the Pico from up to 16v just fine, but the IO pins can only take up to 5V signals in :)

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    It's fixed now thanks to @AkosLukacs so the files will be back in http://www.espruino.com/binaries/travis/­master/

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    Sorry about that, there was a problem with the build - try now and it should update ok:

    http://www.espruino.com/binaries/travis/­master/

    It's possible that you just won't get notifications on the characteristic? What happens if you try to read it?

    You could also try adding 'write':

    security: {
            read: {
              encrypted: true,
              mitm: true,
              lesc: true,
              signed: false
            },  write: {
              encrypted: true,
              mitm: true,
              lesc: true,
              signed: false
            }
          }
    

    It's possible that what's happening is the characteristic is still allowing writes which allow you to turn on notifications - that's something that should probably be fixed in firmware (to automatically stop writes if read is set to require encryption).

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    Thanks - just fixed it, it was a typo in the Makefile (ifndef vs ifdef) that was affecting everything.

    This one should now work:

    http://www.espruino.com/binaries/travis/­7215b960a195ef38cd1f3f5777f5a30dcc406e03­

  • in General
    Avatar for Gordon

    Should be, yes. I believe it looks in a 'modules' directory for any modules.

    eg.

    $ cat modules/bar.js 
    exports = 42;
    
    $ cat foo.js 
    var a = require("bar");
    print(a);
    
    $ espruino -d Pixl foo.js
    # writes it to RAM
    
    $ espruino -d Pixl --minify foo.js
    # writes it to RAM with minification
    
    $ espruino -d Pixl --minify --config MODULE_AS_FUNCTION=true --config SAVE_ON_SEND=1 foo.js
    # writes to flash with minified code
    

    You may also have some success with --config PRETOKENISE=true, which will pretokenise code before upload, saving a bit of flash

Actions