but if I throttle it down enough, it doesn't do it:
var n=0;
NRF.setScan(function(device) {
n++;
if (n&15) return;
Bluetooth.println(JSON.stringify(device));
});
When printing fast and connected by serial, I seem to be able to get out of memory errors as well - which will be due to all the advertising packets queuing up in memory and not being handled fast enough.
Honestly, I'm not sure there's much I can do. Bluetooth LE can only transmit data so fast. If you're printing data faster than it can be output, something has to give.
I'll file a bug for the subsequent crash and will try and sort that out - but even if that's fixed, your code isn't going to work with the print statements in it like that.
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.
It's still working without the println. It seems very stable...
But yes, if I add the Bluetooth.println it prints a solid wall of text and starts locking up after a while. Even this does it:
but if I throttle it down enough, it doesn't do it:
When printing fast and connected by serial, I seem to be able to get out of memory errors as well - which will be due to all the advertising packets queuing up in memory and not being handled fast enough.
Honestly, I'm not sure there's much I can do. Bluetooth LE can only transmit data so fast. If you're printing data faster than it can be output, something has to give.
I'll file a bug for the subsequent crash and will try and sort that out - but even if that's fixed, your code isn't going to work with the print statements in it like that.