tock icon indicating copy to clipboard operation
tock copied to clipboard

Fix temperature sign in bme280 and bmp280 drivers

Open brghena opened this issue 3 years ago • 5 comments

Pull Request Overview

Temperature is a 20-bit, two's complement value in both the BME280 and BMP280 chips. Further, the datasheets provide example code, which treats all units as signed, 32-bit values while doing math.

This came up when considering #2967 and looking through temperature sensor drivers and datasheets. I wanted to decouple it though, since it's chip-specific changes.

Functionally, this PR should make no difference except for temperatures below zero Celsius. They still won't work right until #2967 lands, but that's an easy fix.

Testing Strategy & Help Wanted

I don't have hardware for these sensors! @dcz-self and @alistair23 are you able to ensure I didn't break temperature readings?

TODO or Help Wanted

  • [ ] Test BME280
  • [ ] Test BMP280

Documentation Updated

  • [N/A] Updated the relevant files in /docs, or no updates are required.

Formatting

  • [X] Ran make prepush.

brghena avatar Jul 28 '22 22:07 brghena

For double-checking me, see pages 25-26 here: https://www.mouser.com/datasheet/2/783/BST-BME280-DS002-1509607.pdf and page 22 here: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf

brghena avatar Jul 28 '22 23:07 brghena

Thanks so much for testing this @alistair23. Would you mind running the temperature app again now that I added a commit?

brghena avatar Aug 05 '22 15:08 brghena

Same problem, I get values like this:

check run BME280 Temperature... 
Temperature: 9330
    [ok]
check run BME280 Humidity... 
Humidity: 4294967186
    [ok]

alistair23 avatar Aug 08 '22 02:08 alistair23

Alright, I've got a BME280 breakout coming and will debug. Thanks for trying this out @alistair23

brghena avatar Aug 08 '22 19:08 brghena

@brghena ping!

phil-levis avatar Oct 07 '22 03:10 phil-levis

@brghena reminder on this if you get the chance to work on it! Once it is ready again feel free to re-assign Johnathan

hudson-ayers avatar Mar 15 '24 16:03 hudson-ayers