Does this happen all the time, or is it just occasional calls that give you bad readings?
When it happened every reading before a reboot returned the last valid values, every reading after a reboot returned a 0 for temperature and pressure. Every single reading until the battery was flat.
What firmware version do you have? I did make some improvements to setBarometerPower in a recent build, so if you try one of the 2v14.xxx cutting edge builds this may work better for you?
I use 2.14. I was not aware of 2.14.149 and will try it out.
You could try calling Bangle.isBarometerOn() before you run your code, to see if some other app/widget is keeping the barometer on and causing issues?
I know that Recorder accesses the Barometer in the background.
I tried turning the Recorder off and printing the result of Bangle.isBarometerOn() in my App regularly and the result confuses me.
When i call Bangle.getPressure and get a result that is not "undefined" the sensor shuts down after performing the handler.
If however the reading is "undefined" the sensor stays on until i stop the application, regardless of future calls with valid readings.
This holds for 2.14 and 2.14.149.
I do not know if this is correlated to having only readings of 0, but seems wrong either way.
However it's extremely rate hardware gets locked up - if something like this happens routinely then it's unlikely to be a 'hardware lockup' that is the issue
I cannot think of another explanaition since rebooting and powering off for a few minutes did not help and Indridi found that a firmware reset did not help either.
Only draining the battery seems to help.
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.
When it happened every reading before a reboot returned the last valid values, every reading after a reboot returned a 0 for temperature and pressure. Every single reading until the battery was flat.
I use 2.14. I was not aware of 2.14.149 and will try it out.
I know that Recorder accesses the Barometer in the background.
I tried turning the Recorder off and printing the result of Bangle.isBarometerOn() in my App regularly and the result confuses me.
When i call Bangle.getPressure and get a result that is not "undefined" the sensor shuts down after performing the handler.
If however the reading is "undefined" the sensor stays on until i stop the application, regardless of future calls with valid readings.
This holds for 2.14 and 2.14.149.
I do not know if this is correlated to having only readings of 0, but seems wrong either way.
I cannot think of another explanaition since rebooting and powering off for a few minutes did not help and Indridi found that a firmware reset did not help either.
Only draining the battery seems to help.