Espruino is done with what has to be done in the interval and goes back to deep sleep... which of course switches the LED off.
That's not the case at all. Espruino goes into deep sleep (STOP) modes while still keeping power on all GPIO outputs.
Pretty much all peripherals are powered down, except GPIO which still works (or setWatch wouldn't do anything).
The original code should definitely work, and did work in the past - it's a bug that it doesn't.
interrupts
@Stevie you're spot on. When in deep sleep, you get woken by an interrupt. If that's a watch, it pokes an event into queue and returns (if it's a timer it does nothing except wake up). Espruino then runs around checking timers and also the event queue and executes any JS that needs running.
There's one exception in that you can use setWatch(...., { irq:true }) which will execute a native code function in the IRQ itself. However that function can't even be compiled JS at the moment, as you can get into all kinds of trouble by trying to allocate a Variable while the main loop is also trying to do the same.
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.
That's not the case at all. Espruino goes into deep sleep (STOP) modes while still keeping power on all GPIO outputs.
Pretty much all peripherals are powered down, except GPIO which still works (or
setWatch
wouldn't do anything).The original code should definitely work, and did work in the past - it's a bug that it doesn't.
@Stevie you're spot on. When in deep sleep, you get woken by an interrupt. If that's a watch, it pokes an event into queue and returns (if it's a timer it does nothing except wake up). Espruino then runs around checking timers and also the event queue and executes any JS that needs running.
There's one exception in that you can use
setWatch(...., { irq:true })
which will execute a native code function in the IRQ itself. However that function can't even be compiled JS at the moment, as you can get into all kinds of trouble by trying to allocate a Variable while the main loop is also trying to do the same.