-
• #2
Ok, thanks. I'll take a look. Is this with a KickStarter bangle?
-
• #3
yes
-
• #4
Just fixed in latest firmware I think
-
• #5
yes, this is fixed in
2v12.58
at least.btw, did I misunderstand something, but I thought you made the I2C error catchable earlier? Currently in
2v12.58
it can't be catched. (But this is a minor thing, I can work around this.) -
• #6
Currently in 2v12.58 it can't be catched.
It might be handled as a
promise rejection
- which is different to something that you catch with atry...catch
? -
• #7
Specifically this code doesn't catch it. Do I need to do something different?
setInterval(() => { Bangle.getPressure().then(d => { console.log(d.temperature); }).catch(()=> { // THIS IS NEVER REACHED console.log("ERROR"); }); }, 10 * 1000);
-
• #8
Could you try putting a
try...catch
around that just in case? It shouldn't be needed but would help to track down where the exception comes from -
• #9
I've been running with that for over 2 hours now without I2C error, I'll report here if I manage to reproduce that again. (So good news is that it has become quite rare.)
But I did notice that
d.temperature
from that code sometimes returns completely wrong value. For example here is a list of some successive values:23.70770094008 23.71263150090 23.72249262342 23.73235374710 -0.01203159983 23.83589561600 23.89013188427 23.92464589151 23.95422933763
-
• #10
ok, I got I2C error but I don't quite understand this.
try...catch
catches something but still output says that there is uncaught error.Output:
23.60415923008 23.60415923008 OUTER: undefined Uncaught Error: Unhandled promise rejection: Error: I2C Error: Arbitration (start) 23.64360367590 23.64360367590
Code:
setInterval(() => { try { Bangle.getPressure().then(d => { console.log(d.temperature); }).catch(error => { console.log("INNER: " + error); }); } catch (error) { console.log("OUTER: " + error); } }, 10 * 1000);
-
• #11
Ok, thanks - that's what I thought then. I guess there is an I2C error not when initialising, but when reading the data from the sensor after a timeout. I could add a check in there for that, and I guess it may help to catch those occasional odd temperature values.
But have you tried using
Bangle.on('pressure'
andBangle.setBarometerPower(1)
? If you're doing a reading every 10 seconds it's probably better and far more reliable just to keep the barometer on all the time rather than repeatedly powering it on and off -
• #12
But have you tried using Bangle.on('pressure' and Bangle.setBarometerPower(1)? If you're doing a reading every 10 seconds it's probably better and far more reliable just to keep the barometer on all the time rather than repeatedly powering it on and off
yes, that works better, but in my clock adjust widget the update interval can be much longer than 10 seconds and
Bangle.on('pressure'
causes several updates each second so it likely uses a lot more power. -
• #13
Bangle.on('pressure' causes several updates each second so it likely uses a lot more power.
This is true, but it may not be as bad as you think especially in the ~10 second case - since the barometer takes 1 second to get started each time anyway.
-
• #14
Is there any (simple) way to measure power consumption?
Somehow disconnecting internal battery and using only USB power would be ideal, but I don't think that is possible?
-
• #15
Well, I have a Bangle here where I took it to bits, disconnected the battery and then power it from an external battery with a power meter, but that's about the only method I know of, and it's not easy at all :(
I've noticed new problem with Bangle.js 2 and
Bangle.getPressure()
:Once "I2C Error: Arbitration (start)" happens, all future calls to
Bangle.getPressure()
will fail with "Uncaught Error: Conversion in progress".This never happened with earlier firmwares but I'm now seeing this quite often with 2v12.40