-
Thank you @fanoush for your help. I will definitely try to play with interval and window settings to see if I can increase the packet RX rate, however for my application, trying to synchronize with beacons's advertising interval will probably be too complicated for now.
For those who are interested, after some endurance tests (1 week) with continuous scan, the packet RX rate was around 47%, with a beacon advertising sequentially in all 3 channels every 2 seconds.
If I can increase this number thanks to interval and window settings, I will post result here.What I don't understand is that the raspberry Pi I am using for Home Assistant, achieves nearly 100% RX rate for Espruino devices advertising with BTHome. I guess the BLE advertising mechanism should be reliable enough to achieve 80%+ RX rate at least, maybe something is wrong with the way I am using setScan.
don't know about specific commit but
https://www.espruino.com/Reference#l_NRF_setScan is the documentation,for options it points to
https://www.espruino.com/Reference#l_NRF_requestDevice
So like there is "phy" or "extended" option there is new "window" and "interval" options with value in miliseconds
https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L3008
so something like
should probably scan one channel for 1 second. Once you find the device in the callback you may record current time, stop the scanning
NRF.setScan();
and start it again somehow synchronized to expected advertising interval. like if that is 1 second then start after 900ms and scan e.g with window of 200 for interval 1000 if that improves things and packets will hit the 200ms window every second. I did not actually try this idea yet.