• Hi - that's what you'd expect - so what happens is dump() tries to recreate the current state of the interpreter as code. Because onInit has already run, the watch was added already so it creates code for it.

    So that all looks good. What happens if you're connected via Bluetooth when the LED flashes? Do you get any error messages? You could try putting digitalPulse before update to see if that helps - because if update created an error then execution would stop before it got run.

    ... or maybe:

        setWatch(function (e) {
            try {
              update()
              digitalPulse(LED2, 1, 1) // Show activity
            } catch (e) {
              digitalPulse(LED1, 1, 1) // Show activity
              console.log(e);
            }
        }, D2, { repeat: true, edge: 'falling' })
    

    That'll flash green if it's ok, red if there was an error.

    Could you check E.getBatteryPercentage()? It just might be your battery is on the way out?

    gattserverdisconnected usually happens either if the Puck forces a disconnect (which you're not doing) or if it reboots.

  • It looks like you were right about the battery. Although when I checked, it showed around 50%, every time I checked the percentage varied considerably. It was an old battery, so I changed it for a new one. It's been many days in now and there's not been a single issue with the watch not working.

    Many thanks for helping to fix this issue!

  • I was so sure it was the battery that's the issue as it was working for 4-5 days without issue. Then last night (still with the new battery) it stopped working again.

    So whilst it is broken, when the light on the electric meter flashes, I don't get any light flashing on the Puck (I did implement the try/catch above, but neither the red nor green light flashes). I get no error messages when connected in the IDE. I wondered could it have something to do with the memory slots, but doing process.memory().free showed 2016, which I assume is more than enough.

    Would you happen to have any other ideas what I could try?

About

Avatar for Gordon @Gordon started