Hmm - I just did some changes to the advertising as I was including some other libraries that might have been getting in the way, and now simply typing NRF.sleep() can make this happen.
As far as I can make out, it happens when the device disconnects but doesn't start sending advertising packets again at all.
So you might be able to work around it by delaying your call to NRF.sleep by a second.
This works for me setTimeout("NRF.sleep()",1000);NRF.disconnect() when NRF.sleep() failed, so you might find:
function on_disconnect() {
clear_sleep_timeout();
blinken(0b101);
is_connected = false;
setTimeout("NRF.sleep()",1000); // Prevent reconnection until manually woken
}
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.
Hmm - I just did some changes to the advertising as I was including some other libraries that might have been getting in the way, and now simply typing
NRF.sleep()
can make this happen.As far as I can make out, it happens when the device disconnects but doesn't start sending advertising packets again at all.
So you might be able to work around it by delaying your call to
NRF.sleep
by a second.This works for me
setTimeout("NRF.sleep()",1000);NRF.disconnect()
whenNRF.sleep()
failed, so you might find:works for you?