-
-
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
-
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!
-
-
Quick update, I've got the
heart_rate
service advertising and "working". Note that I lifted thesetAdvertising
values from here and just copied theGAPSETADVDATA
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);
-
0x06
in the heart_rate_measurement is the flags and says that it's got contact.0x40
is the heart rate0x02
is the sensor location value
-
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] } } });
-
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? -
@Gordon I think I've found an adafruit example that I might be able to use as documentation, except I think I need to know where the bit flags for the
setServices
properties are set.For example, if I have
broadcast: true, notify: true
, where are those flags in C? What's the value of the GATT property? (I think…)I've been poking around the C files, but I'm not familiar with the code at all.
-
-
@Gordon yeah, I've been reading through the specs (and parsing existing data).
I know (hmm "know", not sure that's accurate!) that sending a value of
0x06
,0x2c
should send the right flags to say the heart_rate monitor is connected and the heart rate is 44bpm.I was thinking something like this:
NRF.setServices({ 0x180D: { // heart_rate 0x2A37: { // heart_rate_measurement broadcast: true, readable: true, notify: true, indicate: true, value : 0x2C06, } } })
Which does kinda work, but I also believe the device needs to advertise it has heart_rate services - which this doesn't seem to be doing, otherwise filtering for the service doesn't seem to work (or certainly the demo page I'm working from doesn't see it)
-
Quick update:
- Using
setService
doesn't blow away UART (I think this puck was just taking some time to pick up). - I've got a heart_rate advertising, but…it's not quite there.
Note that the value is totally wrong. I'm also trying to connect from a webpage, which doesn't discover that this device has heart_rate (I think it's filtering on the service), but baby steps!
- Using
-
Aside, @Gordon do you have any tips on debugging? Because when I apply the new service, it blows away the Nordic UART so I can't redeploy without pulling the battery and resetting.
If I use
setService
and add the optionuart: true
should I still be able to write? -
I've been reading through an older thread on BT on this forum and I've come to the same thought, that heart_rate should be a service not an advertisement.
I'm going to give that a try now. I took that route to start with, but didn't have much luck…that said, it was 18 hours ago, so maybe my brain has soaked up more of the GATT spec!
Will report back.
-
I'm trying to make a little game with the puck, and the first part of my plan is to advertise the puck as a heart_rate monitor (service: 0x180D).
When I check the puck after a deploy with the Android nRF Connect app, it doesn't list heart_rate as a service.
When I compare to my Pebble, I can see it explicitly listed under flags & services.
The odd thing is I can advertise as a temperature gauge - but it's entirely possible I'm making mistakes.
This is my code:
NRF.setAdvertising({ 0x180D: [ 99 ], 0x1809: [ 30 ], }, { name: "Puck <3", // The name of the device showName: true, // include full name, or nothing discoverable: true, // general discoverable, or limited - default is limited interval: 600, // Advertising interval in msec, between 20 and 10000 });
Temperate correctly shows as 30c (in nRF connect), but the heart_rate is missing.
Any ideas/help?
Thanks!
As per subject, I've got a puck (I think from the kickstarter campaign way back), and when I half insert the (new) battery, it powers up fine and probing the 3V and GND test points gives me 3.00v off the battery.
But once I fully push the battery in, the voltage is around 0.2-0.4v - which explains why I couldn't connect to the Puck anymore.
It's visibly clean inside the Puck and barely used. The cell battery is clean too.
Is this a known (ideally fixable) issue?
Any ideas or advice would be much appreciated.
Thanks in advance.