Digging into it, I found that the app only reads the pressure once and draws, rather than repeatedly updating. On my Bangle.js 2 at least, the first pressure read always returns undefined from the promise, I had a look at the Barometer code in jswrap_bangle.c but I'm not sure which hardware I have or how that C code works really, but it seems something's up with the first read.
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.
I tried the Barometer app (https://banglejs.com/apps/#barometer ) and get the following error:
Uncaught Error: Unhandled promise rejection: Error: Cannot read property 'pressure' of undefined
Digging into it, I found that the app only reads the pressure once and draws, rather than repeatedly updating. On my Bangle.js 2 at least, the first pressure read always returns
undefined
from the promise, I had a look at the Barometer code injswrap_bangle.c
but I'm not sure which hardware I have or how that C code works really, but it seems something's up with the first read.If I run
Bangle.setBarometerPower(1)
first then this isn't a problem, but the app isn't doing that.Is this expected behaviour for the
Bangle.getPressure()
function or should I submit a bugfix for the app until the underlying function is fixed?