Commit ddb872c3 authored by schneider's avatar schneider
Browse files

chore(spo2): Small app cleanup

parent ef21ef02
......@@ -40,8 +40,8 @@ class SPO2:
# don't update on every callback
if self.update_screen >= self.DRAW_AFTER_SAMPLES:
self.disp.clear(self.COLOR_BACKGROUND)
self.draw_histogram(self.ir_history, color.RED)
self.draw_histogram(self.red_history, color.GREEN)
self.draw_history(self.ir_history, color.RED)
self.draw_history(self.red_history, color.GREEN)
spo2, spo2_valid, hr, hr_valid = spo2_algo.maxim_rd117(
self.ir_history, self.red_history
)
......@@ -76,12 +76,6 @@ class SPO2:
# 4x over sampling is active ATM
self.sensor = max86150.MAX86150(callback=callback, sample_rate=self.RATE * 4)
while True:
utime.sleep(0.1)
if buttons.read(buttons.BOTTOM_RIGHT):
pass
while buttons.read(buttons.BOTTOM_RIGHT):
pass
def update_history(self, datasets):
for val in datasets:
......@@ -121,7 +115,7 @@ class SPO2:
self.ir_history = self.ir_history[-self.HISTORY_MAX :]
self.red_history = self.red_history[-self.HISTORY_MAX :]
def draw_histogram(self, history, col):
def draw_history(self, history, col):
# offset in pause_histogram mode
window_end = len(history) - self.histogram_offset
s_start = max(0, window_end - (self.RATE * 2))
......@@ -156,3 +150,10 @@ if __name__ == "__main__":
except KeyboardInterrupt as e:
sensor.close()
raise e
while True:
utime.sleep(0.1)
if buttons.read(buttons.BOTTOM_RIGHT):
pass
while buttons.read(buttons.BOTTOM_RIGHT):
pass
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment