Initially, I even had a timeout of 20 seconds in requestDevice, which led to pretty unreliable connection intitation.
With nrfConnect I see that the sensor starts advertising really fast with an interval of 330ms initially.
I wonder if it is possible to cut the timeout short (right now it seems that the code scans for the full timeout before handing back scan results) and return a matching device immediately?
Or is it preferable to cache the sensor's address and do a direct connect to that later on? That would have the (very small) drawback of needing additional logic to do a full scan if the previous/cached device is not successfully connected, to enable connecting to new/other sensors.
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.
Hi,
sorry for opening a new topic again already, but I hope that our notes might help somebody else later on.
Right now I am connecting like this to my bike sensor:
Initially, I even had a timeout of 20 seconds in requestDevice, which led to pretty unreliable connection intitation.
With nrfConnect I see that the sensor starts advertising really fast with an interval of 330ms initially.
I wonder if it is possible to cut the timeout short (right now it seems that the code scans for the full timeout before handing back scan results) and return a matching device immediately?
Or is it preferable to cache the sensor's address and do a direct connect to that later on? That would have the (very small) drawback of needing additional logic to do a full scan if the previous/cached device is not successfully connected, to enable connecting to new/other sensors.
Thanks,
Joost