Skip to content

Commit c2e059f

Browse files
authored
Merge pull request #18 from beegee-tokyo/master
Sensor values mix up when using multiple sensors
2 parents dbdeac7 + 92597b3 commit c2e059f

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-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
}

src/MAX30105.h

+13
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,17 @@ class MAX30105 {
140140
void readRevisionID();
141141

142142
void bitMask(uint8_t reg, uint8_t mask, uint8_t thing);
143+
144+
#define STORAGE_SIZE 4 //Each long is 4 bytes so limit this to fit on your micro
145+
typedef struct Record
146+
{
147+
uint32_t red[STORAGE_SIZE];
148+
uint32_t IR[STORAGE_SIZE];
149+
uint32_t green[STORAGE_SIZE];
150+
byte head;
151+
byte tail;
152+
} sense_struct; //This is our circular buffer of readings from the sensor
153+
154+
sense_struct sense;
155+
143156
};

0 commit comments

Comments
 (0)