The issue is that when the Pico is properly 'deep' asleep, the high speed oscillator is off (which means there's no clock going to the Serial port either, so it can't receive any data). It's why setDeepSleep isn't just enabled by default.
You can do setWatch on the serial signal, but by the time the Pico has woken up you'll have missed the first character or so of the data - hence why the code above...
what's the resolution to the clock?
It's 1/32768 of a sec when asleep, or when running it's nearer 1/1,000,000 sec - so probably not an issue :) What could be a problem is more the time it takes the JS to execute.
So yes, it might be better to leave the real power saving for a while - I've just tested and without setDeepSleep the Pico is still only using 10mA normally, so for what you want that'll be fine.
The F401 chip in the Pico also has much better clock control - the CPU can slow itself down from 84Mhz, saving a lot of power. That's something I plan on adding soon too - and when that happens you should be able to reduce power consumption a lot without even having to use setDeepSleep.
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.
The issue is that when the Pico is properly 'deep' asleep, the high speed oscillator is off (which means there's no clock going to the Serial port either, so it can't receive any data). It's why
setDeepSleep
isn't just enabled by default.You can do setWatch on the serial signal, but by the time the Pico has woken up you'll have missed the first character or so of the data - hence why the code above...
It's 1/32768 of a sec when asleep, or when running it's nearer 1/1,000,000 sec - so probably not an issue :) What could be a problem is more the time it takes the JS to execute.
So yes, it might be better to leave the real power saving for a while - I've just tested and without setDeepSleep the Pico is still only using 10mA normally, so for what you want that'll be fine.
The F401 chip in the Pico also has much better clock control - the CPU can slow itself down from 84Mhz, saving a lot of power. That's something I plan on adding soon too - and when that happens you should be able to reduce power consumption a lot without even having to use
setDeepSleep
.