Ok, fixed it. If you flash a build from http://www.espruino.com/binaries/travis/36e263aabe91be08ebaf60ef1960807963e2130e then it'll have a function called E.setRTCPrescaler.
The default value is 32000 (what ST say the internal clock speed should be) but let's say you're getting 0.923 average running that code above, you'd do:
// 32000 * 0.923 = 29536
It'll take a few seconds to stabilise, and you might need to do some fiddling to get it a bit more accurate, but that should help you out a lot.
If it looks like it's something useful I'll see about getting it into the main branch of Espruino.
© Espruino, powered by microcosm.
Report a problem