Skip to content
Snippets Groups Projects
Commit d7b8753d authored by schneider's avatar schneider
Browse files

fix(max86150): Use 4x averaging on chip

parent 7a2a5d3c
Branches
Tags
1 merge request!414SpO2 sensor improvements
...@@ -66,6 +66,8 @@ int epic_max86150_enable_sensor( ...@@ -66,6 +66,8 @@ int epic_max86150_enable_sensor(
ppg_sample_rate = MAX86150_PPG_SAMPLERATE_100; ppg_sample_rate = MAX86150_PPG_SAMPLERATE_100;
} else if (config->ppg_sample_rate == 200) { } else if (config->ppg_sample_rate == 200) {
ppg_sample_rate = MAX86150_PPG_SAMPLERATE_200; ppg_sample_rate = MAX86150_PPG_SAMPLERATE_200;
} else if (config->ppg_sample_rate == 400) {
ppg_sample_rate = MAX86150_PPG_SAMPLERATE_400;
} else { } else {
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
......
...@@ -7,7 +7,7 @@ import buttons ...@@ -7,7 +7,7 @@ import buttons
class SPO2: class SPO2:
def __init__(self): def __init__(self):
self.sensor = None self.sensor = None
self.RATE = 128 self.RATE = 100
self.HISTORY_MAX = self.RATE * 4 self.HISTORY_MAX = self.RATE * 4
self.history = [] self.history = []
self.update_screen = 0 self.update_screen = 0
...@@ -35,7 +35,7 @@ class SPO2: ...@@ -35,7 +35,7 @@ class SPO2:
if self.update_screen >= self.DRAW_AFTER_SAMPLES: if self.update_screen >= self.DRAW_AFTER_SAMPLES:
self.draw_histogram() self.draw_histogram()
self.sensor = max86150.MAX86150(callback) self.sensor = max86150.MAX86150(callback=callback, sample_rate=self.RATE * 4)
while True: while True:
utime.sleep(.1) utime.sleep(.1)
if buttons.read(buttons.BOTTOM_RIGHT): if buttons.read(buttons.BOTTOM_RIGHT):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment