Oversampling bits?
szilvasyz opened this issue · 1 comments
Dear Friends,
A question emerged in me during browsing your code. The function checkSampleValue() in SparkFunBME280.cpp seems returning incorrect values for configuration register bitfields in some cases. Table 20, 23 and 24 in the BME280 datasheet show that 4-, 8- and 16-times oversampling should be represented by 0b011 (3), 0b100 (4) and 0b101 (5) bitfield values. As I see, the function now simply returns with values 4, 8 and 16, which are incorrect. Moreover, this return value is used in setXXXOverSample() functions, and values 8 and 16 contain bits that may unintentionally overwrite other fields in registers.
How do you think, maybe am I right, or I had not noticed something?
Best regards,
Zoltan
Hi @szilvasyz ,
Good catch! I updated checkSampleValue() so that it returns the correct value corresponding to the sampling rate as indicated by the data sheet.
Please let me know if you have any questions or notice any more errors such as this.