Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Øyvind Kolås
firmware
Commits
ddb872c3
Commit
ddb872c3
authored
Oct 15, 2020
by
schneider
Browse files
chore(spo2): Small app cleanup
parent
ef21ef02
Changes
1
Hide whitespace changes
Inline
Side-by-side
preload/apps/spo2/__init__.py
View file @
ddb872c3
...
...
@@ -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_histo
gram
(
self
.
ir_history
,
color
.
RED
)
self
.
draw_histo
gram
(
self
.
red_history
,
color
.
GREEN
)
self
.
draw_histo
ry
(
self
.
ir_history
,
color
.
RED
)
self
.
draw_histo
ry
(
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_histo
gram
(
self
,
history
,
col
):
def
draw_histo
ry
(
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment