sparkfun / SparkFun_MAX3010x_Sensor_Library

An Arduino Library for the MAX3015 particle sensor and MAX30102 Pulse Ox sensor
Other
221 stars 148 forks source link

Sensor values mix up when using multiple sensors #18

Closed beegee-tokyo closed 5 years ago

beegee-tokyo commented 5 years ago

When using 2 (or more) sensors on the same device the sensor values read from the sensors can get mixed up. The struct sense is defined as a global and is reused from multiple instances of the MAX30105 class.

Solution: Declare sense as class private

nseidle commented 5 years ago

Good find and excellent fix. Thank you for the PR.

nseidle commented 5 years ago

Pulled into v1.1.0. Thanks!

beegee-tokyo commented 5 years ago

Glad I could help.