Skip to content

Commit e8a0b3e

Browse files
authored
Sensor values mix up when using multiple sensors
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:
1 parent dbdeac7 commit e8a0b3e

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/MAX30105.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,6 @@ static const uint8_t SLOT_GREEN_PILOT = 0x07;
135135

136136
static const uint8_t MAX_30105_EXPECTEDPARTID = 0x15;
137137

138-
//The MAX30105 stores up to 32 samples on the IC
139-
//This is additional local storage to the microcontroller
140-
const int STORAGE_SIZE = 4; //Each long is 4 bytes so limit this to fit on your micro
141-
struct Record
142-
{
143-
uint32_t red[STORAGE_SIZE];
144-
uint32_t IR[STORAGE_SIZE];
145-
uint32_t green[STORAGE_SIZE];
146-
byte head;
147-
byte tail;
148-
} sense; //This is our circular buffer of readings from the sensor
149-
150138
MAX30105::MAX30105() {
151139
// Constructor
152140
}

0 commit comments

Comments
 (0)