Skip to content

Commit

Permalink
sensor: bme280: BMP280 has no humidity sensor
Browse files Browse the repository at this point in the history
Return ENOTSUP when getting the humidity channel if the driver is used
with a BMP280, since this device does not provide humidity readings.

Signed-off-by: Josep Puigdemont <[email protected]>
  • Loading branch information
joseppc authored and MaureenHelm committed Jul 27, 2023
1 parent 17fb2a1 commit 677d377
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/sensor/bme280/bme280.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ static int bme280_channel_get(const struct device *dev,
(((data->comp_press & 0xff) * 1000U) >> 8);
break;
case SENSOR_CHAN_HUMIDITY:
/* The BMP280 doesn't have a humidity sensor */
if (data->chip_id != BME280_CHIP_ID) {
return -ENOTSUP;
}
/*
* data->comp_humidity has 22 integer bits and 10
* fractional. Output value of 47445 represents
Expand Down

0 comments on commit 677d377

Please sign in to comment.