@Gordon
I think it's not worth increasing base energy consumption just to handle this case.
That snippet does indeed provide some reliability, but still - I think in that situation it's more appropriate to "restore reliability" rather by replacing the battery than repeatedly restarting the magnetometer.
To clarify - I'm not looking for a hack around this particular problem, but rather trying to clarify (in documentation) expectations of reliability and/or make the API more reliable.
Do you think such detail (the "unreliable" behaviour of mag, light) is appropriate for Reference and/or some other place? Or is this something you'd reckon most folks come expecting?
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.
@Gordon
I think it's not worth increasing base energy consumption just to handle this case.
That snippet does indeed provide some reliability, but still - I think in that situation it's more appropriate to "restore reliability" rather by replacing the battery than repeatedly restarting the magnetometer.
To clarify - I'm not looking for a hack around this particular problem, but rather trying to clarify (in documentation) expectations of reliability and/or make the API more reliable.
If you agree, I'd try to make some PRs to add detail to
Puck.mag
,Puck.magOn
, andPuck.light
in https://www.espruino.com/Reference.Do you think such detail (the "unreliable" behaviour of
mag
,light
) is appropriate for Reference and/or some other place? Or is this something you'd reckon most folks come expecting?