The value returned is in 22.10 fixed point format. This means that the result must be shifted right 10 bits to get the integer part (not divded by 1000). All compensate functions (double and fixed point), when out of range , MUST NOT report xxx_MAX ( or xxx_MIN), rather they MUST report xxx_ERR. It appears that recent changes to BME280_driver/bme290.c ignored the statments var5 = (var5 < 0 ? 0 : var5); var5 = (var5 > 419430400 ? 419430400 : var5); // 419430400 is 0x19000 which is decimal 100<<12 in 22.10 format Which (INCORRECTLY) set the return value to 100.00 when the value is greater than 100.00 (format 22.10) +++++ Current coding practices suggest that these should be constants in the bme280.h file For example something similar to: #ifdef BME280_FLOAT_ENABLE #define TEMPERATURE_MIN -40.00 #define TEMPERATURE_MAX 85.000 #define TEMPERATURE_ERR 88.000 #define HUMIDITY_MIN 0.000 #define HUMIDITY_MAX. 100.00 #define HUMIDITY_ERR 200.000 ... #ifdef BME280_64BIT_ENABL E #define HUMIDITY_MIN 0 #define HUMIDITY_MAX 100<<10 #define HUMIDITY_ERR 200<<10 ... And the code something like: if ( (humidity < HUMIDITY_MIN) || (humidity > HUMIDITY_MAX ) ) return HUMIDITY_ERR; It seems nearly impossible to correctly provide a code segment containing a hash symbol here as the web page insists on doing a search when one is entered. I give up trying to make this a correct code segment.
... View more