adafruit / Adafruit_BMP085_Unified

Unified sensor driver for Adafruit's BMP085 & BMP180 breakouts
93 stars 60 forks source link

Calibration data is not stored in a way that allows multiple sensors #19

Open ekozlenko opened 8 years ago

ekozlenko commented 8 years ago

Tried using two BMP180's with an Arduino Uno. I got around the identical I2C address for the two chips by using an analog MUX (CD4052BE) to switch which sensor was connected to the I2C bus at what time. I was able to initialize the two sensors as separate instances of the Adafruit_BMP085_Unified class. However the readings did not agree when switching from one sensor to the other. After digging around I figured out that the library seems to keep track of only one set of calibration data that is pulled from the sensor, so that which ever sensor was the last one to be initialized with the .begin() command was the one whose call data was used by the library.

I'm sure this issue doesn't effect most people who would typically only use a single sensor at a time, but it's a pretty big issue for anyone trying to use more than one. I'm not an adroit enough coder to correct this issue and do a pull request, but a fix would be greatly appreciated. For now, I'll just have to reinitialize the sensors whenever I switch between them. This will slow things down.