Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Mar 2019

Most recent activity

  • in Interfacing
    Avatar for Gordon

    Nice - thanks! Did you find a reference somewhere that 15uS was ok though?

    As far as I could find, Nordic say that disabling IRQs even for a small amount of time will break the connection eventually: https://devzone.nordicsemi.com/f/nordic-­q-a/7321/how-to-enable-and-disable-all-i­nterrupts

    Ideally I'd like to avoid doing something that they very specifically say not to do.

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

    That's great! If you get a moment it'd be really good if you could post up some example code for how to handle this on both sides :)

  • in Other Boards
    Avatar for Gordon

    Just to say thanks - I updated the compiler to GCC 8 and it seems to work pretty well. It's also knocked ~8k off the size of some firmware builds which is a great help where it's getting a bit tight!

  • in Pico / Wifi / Original Espruino
    Avatar for Gordon

    Just a note to say I found a newer version of esprima/esmangle that appears to fix this problem, so that should go into the IDE soon.

  • in Interfacing
    Avatar for Gordon

    Nice - thanks! If it's doing stuff that isn't served by another library then I'd definitely be interested in having it in, although my preference is to try and improve existing modules rather than create new ones wherever possible.

    How does this compare with something like http://www.espruino.com/tinyMQTT ? I believe that should do last will and reconnect already.

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

    With the battery percentage, that's about what you'd expect. I've attached a the discharge curve I copied from a CR2032 datasheet I googled: http://data.energizer.com/pdfs/cr2032.pd­f

    Basically the voltage doesn't change noticeably for the first 50% of the battery life (in fact it might even rise!) so it's very difficult to come up with any accurate measurement based on it, especially as the voltage changes far more with temperature (and the amount depends on the exact cell used).

    Puck.js's battery measurement doesn't try to do anything smart, it just returns how far the voltage is between 2.8 and 2.2v -so by the time it's registering a drop the battery is already reasonably empty.

  • in Other Boards
    Avatar for Gordon

    The Puck's capsense code is here: https://github.com/espruino/Espruino/blo­b/master/targets/nrf5x/nrf5x_utils.c#L61­

    But I actually don't use the hardware variant - I use the simple software one below it.

    Just FYI -if you want to see how something is done, look in http://www.espruino.com/Reference and after the title of a function there's a => symbol - click on that and you'll go right to GitHub where it's defined.

    Here's some code you can use. I'll update the NRF52LL page:

    function capSense2(PINDRV, PIN1, PIN2) {
      var ll = require("NRF52LL");
      digitalWrite(PINDRV,0);
      digitalRead([PIN1,PIN2]);
      // create a 'toggle' task for output
      var t0 = ll.gpiote(0, {type:"task",pin:PINDRV,lo2hi:1,hi2lo:1,­initialState:0});
      // two input tasks, one for each cap sense input
      var e1 = ll.gpiote(1, {type:"event",pin:PIN1,lo2hi:1,hi2lo:0})­;
      var e2 = ll.gpiote(2, {type:"event",pin:PIN2,lo2hi:1,hi2lo:0})­;
      // create a timer that counts up to 1000 and back at full speed
      var tmr = ll.timer(3,{cc:[1000],cc0clear:1});
      // use a PPI to trigger toggle events
      ll.ppiEnable(0, tmr.eCompare[0], t0.tOut);
      // use 2 more to 'capture' the current timer value when a pin changes from low to high
      ll.ppiEnable(1, e1.eIn, tmr.tCapture[1]);
      ll.ppiEnable(2, e2.eIn, tmr.tCapture[2]);
      // Manually trigger a task to clear and start the timer
      poke32(tmr.tClear,1);
      poke32(tmr.tStart,1);
      return { read : function() {
        return [ peek32(tmr.cc[1]), peek32(tmr.cc[2]) ];
      } };
    }
    
    var cap = capSense2(D25, D31, D5);
    
    setInterval(function() {
      console.log(cap.read());
    },500);
    
  • in JavaScript
    Avatar for Gordon

    Wow, thanks for narrowing this down. Turns out it's to do with outputting a hex value under 32 but above 7, and THEN outputting under 8.

    This reliably does it:

    >String.fromCharCode(0x1f)
    ="\x1F"
    >String.fromCharCode(7)
    ="\71F"
    

    It's just been fixed!

  • in Other Boards
    Avatar for Gordon

    Thanks! Yes, I will do one soon - I don't have a particular date planned but ideally I'd get some kind of automated test harness set up first, since there seems to be a bug in Nordic's NFC implementation and it's proving painful to get one single build where NFC works on all nRF52s!

  • in Projects
    Avatar for Gordon

    PROJECTNAME

    That's odd - looking at the git commits the only mentions of PROJECTNAME for the Makefile are in lines you added, so I don't know why it wouldn't work.

    would it be possible to add md files to http://www.espruino.com/modules

    Not really - there isn't a 1:1 mapping (eg. fonts - there are lots of fonts, but only one font page).

    The modules dir is filled using https://github.com/espruino/EspruinoDocs­/blob/master/buildmodules.sh - so you could just scan devices modules boards for js files, it's just not a very robust solution.

    But you'll still find that for certain .js files there is no .md file to go along with them - if you're going to do that, why not check whether espruino.com/MODULENAME returns a 404 or not and then link to it if it's fine.

    The .md files (as mentioned in the header in each one) contain extra tags (like APPEND_KEYWORDS/etc) that doesn't render properly if you just view the file on its own, so realistically you're better off pointing direct to espruino.com.

Actions