Skip to content

Commit

Permalink
Sensor values mix up when using multiple sensors
Browse files Browse the repository at this point in the history
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:
  • Loading branch information
beegee-tokyo authored Dec 17, 2018
1 parent dbdeac7 commit e8a0b3e
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/MAX30105.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,6 @@ static const uint8_t SLOT_GREEN_PILOT = 0x07;

static const uint8_t MAX_30105_EXPECTEDPARTID = 0x15;

//The MAX30105 stores up to 32 samples on the IC
//This is additional local storage to the microcontroller
const int STORAGE_SIZE = 4; //Each long is 4 bytes so limit this to fit on your micro
struct Record
{
uint32_t red[STORAGE_SIZE];
uint32_t IR[STORAGE_SIZE];
uint32_t green[STORAGE_SIZE];
byte head;
byte tail;
} sense; //This is our circular buffer of readings from the sensor

MAX30105::MAX30105() {
// Constructor
}
Expand Down

0 comments on commit e8a0b3e

Please sign in to comment.