• 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!

About

Avatar for Fisu @Fisu started