call this .... manually every 5 seconds or so, is that ok?
Yes, that should be totally fine.
The problem is that it can takes a long time (like 3-5 seconds) for scan to pick up the changes
Do you know roughly how often you're getting BLE advertisements from setScan? I think it's quite likely you're in a reasonably congested area and there are so many devices it's having trouble processing fast enough
Can NRF.requestDevice read advertising data (the state) from the other Puck?
Yes - you'll get the exact same response you would from setScan.
For instance if you do this it should be really nice and easy:
NRF.requestDevice({filters:[{name:"Pixl.js 8999"}]}).then(function(dev) {
if (dev.manufacturerData)
print("State is "+dev.manufacturerData[0]);
})
It's a shame you can't filter by id at the moment though - only name/services
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, that should be totally fine.
Do you know roughly how often you're getting BLE advertisements from
setScan
? I think it's quite likely you're in a reasonably congested area and there are so many devices it's having trouble processing fast enoughYes - you'll get the exact same response you would from
setScan
.For instance if you do this it should be really nice and easy:
It's a shame you can't filter by id at the moment though - only name/services