I'm not sure what to suggest here I'm afraid... The way setServices works it shouldn't really be able to call the handler twice. What if you add some kind of 'print' statement inside onWrite: (e) => cc.read(new Uint8Array(e.data)) just in case your cc.read method is doing something internally?
You could also check on your watch to ensure your code isn't in there twice (eg in two separate files). You could check with:
require("Storage").list().forEach(f=>{
if (require("Storage").read(f).includes("0xf012")) print(f);
});
If it's ok, it should be in just .boot0 and in your app.boot.js file
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.
I'm not sure what to suggest here I'm afraid... The way
setServices
works it shouldn't really be able to call the handler twice. What if you add some kind of 'print' statement insideonWrite: (e) => cc.read(new Uint8Array(e.data))
just in case yourcc.read
method is doing something internally?You could also check on your watch to ensure your code isn't in there twice (eg in two separate files). You could check with:
If it's ok, it should be in just
.boot0
and in yourapp.boot.js
file