-
• #2
Just realized that I can recreate the issue in the web IDE with the same code, see attachment.
After uploading the code multiple times, the event is logged multiple time on the console. -
• #3
The issue is you've defined a function called
reset
which overwrites the Bangle's built-inreset
function (which is used to reset the device and is called at upload time before the upload).So when it goes to reset the watch, that gets called and it doesn't actually get reset!
If you just rename the
reset
function it should all work great :) -
• #4
Aaargh! 🤦 Thanks!
Hi,
I'm using
espruino -d Bangle.js -w index.js
to connect to my Bangle.js in watch mode. Everytime I change the file in my local IDE, it is re-uploaded and re-executed like expected.I've noticed that sometimes after I changed the file and it gets uploaded, the console shows
while sometimes only
is shown, especially when I'm working on a larger file.
In the latter case, however, the state on the watch is not reset correctly and event handlers are added up. For example, this code
makes the log message appear multiple times after multiple file uploads.
When I long-press the button and then trigger a re-upload, the state is reset correctly.
Is there anything I can do to re-initialize the event handlers before each re-upload in watch mode?
Unfortunately, the small code example above does not reproduce the problem. It only happens with some larger code file.
Kind regards,
Johannes