05-05-2021 02:06 PM
Hi Guys
So, I've had a sensor in production for the last 3 years, to report Temperature & RH, using the BME280.
Recently, I've noted that at higher Humidity conditions and Lower Temperatures, the compensated RH result jumps from say 70% at 12°C to 100%.
Revisiting the latest data sheet (R1.9), Section 8.1 documents example C code to resolve RH.
Trying to turn the following in to intelligable format to impliment for integer process, I've hit several ambiguities...
double bme280_compensate_H_double(BME280_S32_t adc_H); { ... Unexpected semi-colon
then this superlative line of code:
var_H = (adc_H – (((double)dig_H4) * 64.0 + ((double)dig_H5) / 16384.0 * var_H)) * (((double)dig_H2) / 65536.0 * (1.0 + ((double)dig_H6) / 67108864.0 * var_H * (1.0 + ((double)dig_H3) / 67108864.0 * var_H)));
Any one any suggestion as to the order of preference that should be applied withing parenthasis? I was taught BODMAS, Brackets of, Division, Multiplication, then Addition and Substarction. IMO, the above line of code could do with a make over. I'd then be happy to share an integer math equivalent for
any one else implimenting on an 8 or 16 bit micro...
05-05-2021 05:42 PM