Maybe checking E.getAnalogVRef() going below 3.3V could signal empty battery.
Since that time I had simple interval checking voltage every second and toggling LED if it is below 3.27V and today I noticed it started blinking and voltage is 3.18V now. So it lasted about 2 months on single charge just advertising and sitting on table (Date() says February 25 1970), that is very similar to smartwatches like Magic3. And even if I can't measure battery voltage directly the getAnalogVRef can be used to detect low battery when it gets below 3.3V.
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.
Since that time I had simple interval checking voltage every second and toggling LED if it is below 3.27V and today I noticed it started blinking and voltage is 3.18V now. So it lasted about 2 months on single charge just advertising and sitting on table (Date() says February 25 1970), that is very similar to smartwatches like Magic3. And even if I can't measure battery voltage directly the getAnalogVRef can be used to detect low battery when it gets below 3.3V.