• 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

  • 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
    
  • 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);
    
About

Avatar for Gordon @Gordon started