farmerkeith / BMP280-library

This is an Arduino library for the BME280 and BMP280 sensors.
18 stars 9 forks source link

Looks strange #2

Open x893 opened 5 years ago

x893 commented 5 years ago

dig_H4 = b1[3] 16 + (b1[4] && 0x0F); // dig_H4 is uint16_t dig_H5 = b1[5] 16 + (b1[4] && 0xF0) / 16; // dig_H5 is uint16_t

if (b1[3] >> 7) dig_T2 = dig_T2 + 0xFFFF0000; ...

ujur007 commented 4 years ago

To me also the following looks strange

dig_T1 = b1[0] + (b1[1] 256); // unsigned dig_T2 = b1[2] + (b1[3] 256); if (b1[3] >> 7) dig_T2 = dig_T2 + 0xFFFF0000; dig_T3 = b1[4] + (b1[5] * 256); if (b1[5] >> 7) dig_T3 = dig_T3 + 0xFFFF0000;

Instead, it could be unsigned and signed sort types and then no need for the above calcs.. Also, how the values are being calculated here?