Barometer 'pressure' event: Control sampling rate

Posted on
  • By hooking into the barometers 'pressure' event i sometimes get only ~1 reading per second, and sometimes ~10 readings per second.

    Because i didn't find a method to control the sapling frequency, i assumed it will be controlled by Bangle.setPollInterval(), together with acc/gyr polling. I tried setPollInterval(80), and first this seems to work, but now the application still falls back to ~1 reading per second. Maybe because the application was getting more complicated, consuming more performance, and by this causing the barometer to save power?

    Does anyone know how to control the barometer sampling rate? And how reliable this sampling rate is?

  • Hi - the barometer is 'polled' by the same code that handles the accelerometer as you noted. I think the issue you're hitting is the accelerometer power saving code (which detects when the Bangle isn't moves, and goes to a lower poll rate to save power).

    You could use Bangle.setOptions({powerSave:false}) to stop it happening: http://www.espruino.com/Reference#l_BangĀ­le_setOptions

    Or the reason it's resetting after you call setPollInterval(80) is that 80ms is the default poll interval, so it's seeing that and is then thinking it's the default so it's ok to change to the low power mode. If you did setPollInterval(75) you'd probably find it stayed at 75ms just fine.

    Does anyone know how to control the barometer sampling rate? And how reliable this sampling rate is?

    I don't know for sure, but I wouldn't think the same rate is super reliable either way. Depending on whether you have a KickStarter Bangle.js 2 or have bought one later there's a different barometer, so that'll change the behaviour too.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Barometer 'pressure' event: Control sampling rate

Posted by Avatar for Alberich123 @Alberich123

Actions