sensor: bme280: BMP280 has no humidity sensor

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 <josep.puigdemont@gmail.com>
This commit is contained in:
Josep Puigdemont 2023-07-21 17:48:36 +02:00 committed by Maureen Helm
parent 17fb2a1fb5
commit 677d377299

View file

@ -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