Avatar for Thinkscape


Member since May 2017 • Last active May 2018
  • 5 conversations

Most recent activity

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

    I've got 2 pucks.

    1. I've replaced their batteries and updated to firmware v97.
    2. I've uploaded same code via Web IDE.
    3. One puck is happy and working all the time.
    4. The other puck, after ~2-3h, will start blinking red.
    5. It advertises as "Puck js XXX" instead of my name (which means it's reset itself and not running my code)
    6. When trying to connect via Web IDE, it shows up on the list but then "error connecting" pops up.
    7. Nail-reset doesn't help.
    8. Taking out battery and reinserting after 1min allows to connect again, re-upload code.
    9. After ~2-3h, it will start blinking red again.

    What can I do?

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

    Hey again! :-)

    This time, it's about Puck.getBatteryPercentage().

    I've got two pucks, purchased together. One is showing a steady 100% battery at all measurements (calls to getBatteryPercentage()), the other one is fluctuating up to 15%. Measurements are made every 30s, the code is the same, no connections, only BLE advertisements.

    Here's how it looks like on a 12h graph:

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

    I'm testing something now... I've put the over-high puck into freezer for a minute (went down to ~15 deg). I've then put them together on a table and let them "settle".

    The second puck has also been triggering button presses when I picked it up, or when gently tapping it (without the click, just vibrations).

    I've since reset it again, uploaded my code again and let it settle with temp. I now have around 3 deg difference between them, which is not bad. I'm calibrating them now with a primitive thermometer.

    I'll try to get a more accurate one and calibrate them both again, and see if I get this weird behaviour again.

    I'll report back. Thanks!

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

    Hey guys, I need some advice.

    I've purchased two Puck-s (to start with), and I'm running exactly the same code on both, which reports temperature via BLE advertising (example from docs).

    I'm seeing wildly different readings between both -- look at the screenshot below.
    One would report 19, while the other: 27 degrees.

    Is it something I should consider normal?

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

    Thanks mate! Works like a charm.
    I'll update the docs, maybe it'll be useful for others as well.

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

    I'm not 100% sure the docs you found are for the UUID 0x1809 that's being used though

    GATT docs list that as:

    Health Thermometer  org.bluetooth.service.health_thermometer­    0x1809

    It matches your example in docs. From what I can tell 0x2A1C is a code for "temperature measurement", while 0x1809 is the code for the "health thermometer" service as a whole. Not sure if the NRF library we're using even has a notion of those formats, or is it up for us to provide an implementation.

    The issue is with the EspruinoHub's decoding. It's doing something pretty simple right now - 8 bit is interpreted as-is, and 16 bit is the temperature x100

    Hmm... it seems that you're bitshifting the second value ((((a[1]<<8)+a[0])/100)), which makes it hard for me to reverse it.

    How would you encode a 16 bit float to this that would work on puck (i'm assuming its BE)?

    function encodeFloat(num) {
      const dec = Math.round(n);
      const fractional = Math.round(n % 1 * 100);
      return [ dec, fractional >> 8 ]; // ???