Ahh - this could be related to 'echo'.
So normally, when you write text to Espruino in the REPL it echoes back those characters so you can see what you typed (plus the JS prompt >). Probably if you dump the data you're getting from rxCharacteristic you'll see a bunch of stuff coming back. It might actually help to remove all the lines to do with rxCharacteristic if you don't care about the data coming back - that might improve things.
The data that can be sent on BLE is about the same as what can be received, so if you keep sending data to Puck.js it'll keep sending those characters back (plus a few) and it ends up spending all its time waiting to send characters. Eventually it runs out of memory and drops some. I'm not sure it explains the connection issues though.
You can manually turn that off by sending "echo(0);\n" first (and back on with echo(1).
Or - what the Web IDE does is:
So just adding "\x03\x10" to the front of the code you send (and removing any newlines) might well fix it for you?
© Espruino, powered by microcosm.
Report a problem