-
• #2
Wow, this does seem very odd - I'm glad you got a solution though (sending a RESET command).
So when it happens, what does:
Bangle.getPressure().then(d=>{ console.log(d); // {temperature, pressure, altitude} });
return? Is it an object with zeros, or do you get an error instead?
Are you running an app that keeps the barometer on kind-of permanently? Or do you know if it turns it on and off repeatedly?
Looking at the code we only issue a software reset to the barometer on boot, but we could do it each time the barometer is powered on (although that may not help too much if you have something that keeps it powered all the time)
-
• #3
The getPressure() actually returned 0 for all its 3 values, same as https://forum.espruino.com/comments/16642885/
Initially I had the widget widbaroalarm running last week when it failed, but it was uninstalled and the error occurred with only thermom running. Afaik both toggle the power state of the sensor.
-
• #4
Maybe automatically reset if both sensor values to read zero?
-
• #5
I just had another look into this, and I did spot an issue where
getPressure
could end up leaving the Barometer on if it got just one bad value, which it seems could in some cases cause this behaviour.I did try adding a reset as you did (but in the firmware) but it wasn't quite that simple - I think I may have to leave some delay to allow the reset to take effect.
I've fixed the issue above though, so if you try a cutting edge firmware now it may fix it
-
• #6
ok cool. I hit the problem again today, so updating firmware now.
-
• #7
With the firmware 2v16.10 I have a ~50% chance of undefined for Bangle.getPressure(). This is from the IDE:
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
{ "temperature": 29.57211303710, "pressure": 1008.98850875296, "altitude": 35.54039353922 }
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
{ "temperature": 29.57535298665, "pressure": 1008.98815103067, "altitude": 35.54338200327 }
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
undefined
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
{ "temperature": 29.61423238118, "pressure": 1008.98636565159, "altitude": 35.55829733279 }
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
undefined
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
undefined
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
undefined
Bangle.getPressure().then(d=>{
: console.log(d);
: // {temperature, pressure, altitude}
:});
=Promise: { }
{ "temperature": 29.68842061360, "pressure": 1008.98390526754, "altitude": 35.57885179204 } -
• #8
Ok, thanks - I see
undefined
returned on the first call for devices here, but subsequent ones seem ok. Widgets/etc that usegetPressure
should usually cope with this I think.I think if the Barometer is actually powered on first with
Bangle.setBarometerPower(1)
things should be ok. So the question is now - can your Bangle ever get into that position where the barometer stops working with the new firmware?I also had a play here and I tried waiting a bit longer before requesting data from the barometer, and it actually made matters worse - I was seeing
undefined
about 2 in 3 attempts! I've shortened the delay slightly and at least on my device it makes getPressure work all the time - so maybe if you try the absolute latest firmware it'll be ok -
• #9
Cool, thanks. This one seem to be fixed. I'll observe the first issue, but it can take weeks or month to happen again (or not).
-
• #10
Still happens from time to time on firmware 2v16.11. So far Bangle.barometerWr(0x0c, 9) and restarting the Bangle always worked.
As a followup to https://forum.espruino.com/conversations/378757/#16645817
Temperature & Barometer of the SPL06 read 0 again last week, so I discharged the battery again. After charging the Bangle both sensors worked again..for 1 hour.
I kept the thermom app open for approx 1 hour and at sometime it stopped updating the temperature. After issuing a long-press-reboot both sensor values read 0 again.
This time I did not want to fully discharge the watch again so I tried a soft reset with
Currently I get plausible sensor reading. Any ideas what is going on here?
I'm inclined to add this command to a boot file or somewhere in the settings menu if it happens more often.