Avatar for remy

remy

Member since Dec 2016 • Last active Mar 2020
  • 2 conversations
  • 15 comments

Most recent activity

  • in Bangle.js
    Avatar for remy

    thank you 👍

    • 3 comments
    • 642 views
  • in Bangle.js
    Avatar for remy

    I feel like I'm missing something obvious - but I've tried to hunt around first.

    How do I persist an app/code I've written myself to the bangle?

    When I upload from the IDE, returning to the menu on the watch loses the state that's been updated and I lose my software.

    Whereas apps I've uploaded via the banglejs.com/app "store" do persist. I gather I'm missing something (obvious?).

    Thanks in advance.

    – Remy

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

    Yeah, putting the setAdvertising in the update did seem to do the trick.

    Still a bit weird that the name isn't set, though I can see it on the nRF Connect app if I explicitly read the value, but my browser (via webBT) is still reading the old "Pluck 1234" value. Not a biggie though.

    Now seeing if I can add some more services to this poor little puck!

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

    One really weird thing I do see, is if I redeploy the code, the service no longer advertises correctly (it's like it completely resets).

    I'm having to do a hard reset on the puck to get back to advertising.

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

    Quick update, I've got the heart_rate service advertising and "working". Note that I lifted the setAdvertising values from here and just copied the GAPSETADVDATA value into a hex array, but I really don't understand why it works.

    var hr = 65;
    
    function update() {
      hr++;
      if (hr > 120) {
        hr = 65;
      }
      
      NRF.updateServices({
        0x180D: { // heart_rate
          0x2A37: { // heart_rate_measurement
            notify: true,
            value : [0x06, hr],
          }
        }
      });
      
      setTimeout(update, 1000);
    }
    
    NRF.setServices({
      0x180D: { // heart_rate
        0x2A37: { // heart_rate_measurement
          notify: true,
          value : [0x06, hr],
        },
        0x2A38: {
          readable: true,
          value: [0x02]
        }
      }
    });
    
    
    NRF.setAdvertising([
      0x02,
      0x01,
      0x06,
      0x05,
      0x02,
      0x0d,
      0x18,
      0x0a,
      0x18
    ], {
      name: "puck heart", // this doesn't stick at all, no idea why
      showName: true,
      discoverable: true,
      interval: 600
    });
    
    // if I update too early, it seems like GATT is still trying to do the previous updates
    setTimeout(update, 2000);
    
  • in Puck.js, Pixl.js and MDBT42
    Avatar for remy
    • 0x06 in the heart_rate_measurement is the flags and says that it's got contact.
    • 0x40 is the heart rate
    • 0x02 is the sensor location value
  • in Puck.js, Pixl.js and MDBT42
    Avatar for remy

    Quick update, I'm able to read heart rate of 40bpm (with contact detected) and body sensor location: wrist on nRF.

    But it's not advertising (yet).

    Here's the code (because I'm not tracking changes!):

    NRF.setServices({
      0x180D: { // heart_rate
        0x2A37: { // heart_rate_measurement
          notify: true,
          readable: true,
          broadcast: true,
          value : [0x06, 0x40],
        },
        0x2A38: {
          readable: true,
          value: [0x02]
        }
      }
    });
    
  • in Puck.js, Pixl.js and MDBT42
    Avatar for remy

    Looking at this:

    AT+GATTADDCHAR=UUID=0x2A37, PROPERTIES=0x10, MIN_LEN=2, MAX_LEN=3, VALUE=00-40
    

    I'm not 100% sure how to represent the value 00-40 in a way that the puck will understand. Would I give it hex? Is this something else?

    I'm guessing that properties is one of the flags like readable, notify, etc - but not sure which. Is this the same as [0x00, 0x40]? Any ideas?

Actions