From 264ec4ca5f014f64b67b9cea1a91c182c6c77e70 Mon Sep 17 00:00:00 2001 From: lilian Date: Wed, 7 Sep 2016 14:25:17 +0200 Subject: [PATCH] Revert "Update bmp280.c" This reverts commit c8a590f8789b8ca0edc26dab579706462a41455f. --- extras/bmp280/bmp280.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/bmp280/bmp280.c b/extras/bmp280/bmp280.c index 78ca245..ab81dae 100644 --- a/extras/bmp280/bmp280.c +++ b/extras/bmp280/bmp280.c @@ -61,7 +61,6 @@ void bmp280_init_default_params(bmp280_params_t *params) params->mode = BMP280_MODE_NORMAL; params->filter = BMP280_FILTER_OFF; params->oversampling = BMP280_STANDARD; - params->oversampling_temperature = BMP280_STANDARD ; params->oversampling_humidity = BMP280_STANDARD; params->standby = BMP280_STANDBY_250; } @@ -195,11 +194,14 @@ bool bmp280_init(bmp280_t *dev, bmp280_params_t *params) return false; } + uint8_t oversampling_temp = + (params->oversampling == BMP280_ULTRA_HIGH_RES) ? 2 : 1; + if (params->mode == BMP280_MODE_FORCED) { params->mode = BMP280_MODE_SLEEP; // initial mode for forced is sleep } - uint8_t ctrl = (params->oversampling_temperature << 5) | (params->oversampling << 2) + uint8_t ctrl = (oversampling_temp << 5) | (params->oversampling << 2) | (params->mode);