Wow, that is strange - your code looks absolutely fine.
If there was other code that used digitalRead and then an input wasn't connected to anything, random electrical noise can keep waking the Puck up and can drain the battery quite quickly - but in the default state the inputs are set so that doesn't happen.
Also the hardware serial should only initialise if D28 is actually pulled up to 3.3v at boot - having it just happening to 'float' at 3.3v wouldn't be enough.
You could try using setSleepIndicator(LED1) to see if anything is waking the Puck up?
Very early firmwares had an issue where NFC usage would cause a 1mA power draw, but that was fixed a year or more ago. It also used to be (pre 2.00) that keeping a connection open would draw a decent amount of power, but in v2.00 even that's changed and having a connection to whatever device controls the Puck won't draw much more power than having it just advertising.
About the only other thing I can think of is whether a device is continually connecting/disconnecting to that Puck?
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.
Wow, that is strange - your code looks absolutely fine.
If there was other code that used
digitalRead
and then an input wasn't connected to anything, random electrical noise can keep waking the Puck up and can drain the battery quite quickly - but in the default state the inputs are set so that doesn't happen.Also the hardware serial should only initialise if D28 is actually pulled up to 3.3v at boot - having it just happening to 'float' at 3.3v wouldn't be enough.
You could try using
setSleepIndicator(LED1)
to see if anything is waking the Puck up?Very early firmwares had an issue where NFC usage would cause a 1mA power draw, but that was fixed a year or more ago. It also used to be (pre 2.00) that keeping a connection open would draw a decent amount of power, but in v2.00 even that's changed and having a connection to whatever device controls the Puck won't draw much more power than having it just advertising.
About the only other thing I can think of is whether a device is continually connecting/disconnecting to that Puck?