Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
6cc393ed
Commit
6cc393ed
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(spo2): Option to select Red/IR as source
parent
c28aed8d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!414
SpO2 sensor improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/apps/spo2/__init__.py
+16
-3
16 additions, 3 deletions
preload/apps/spo2/__init__.py
with
16 additions
and
3 deletions
preload/apps/spo2/__init__.py
+
16
−
3
View file @
6cc393ed
import
max86150
import
display
import
utime
import
buttons
class
SPO2
:
...
...
@@ -20,6 +22,7 @@ class SPO2:
self
.
avg_pos
=
0
self
.
last_sample
=
0.0
self
.
filtered_value
=
0.0
self
.
source
=
"
Red
"
def
open
(
self
):
def
callback
(
datasets
):
...
...
@@ -33,12 +36,21 @@ class SPO2:
self
.
sensor
=
max86150
.
MAX86150
(
callback
)
while
True
:
pass
utime
.
sleep
(.
1
)
if
buttons
.
read
(
buttons
.
BOTTOM_RIGHT
):
if
self
.
source
==
"
Red
"
:
self
.
source
=
"
IR
"
else
:
self
.
source
=
"
Red
"
while
buttons
.
read
(
buttons
.
BOTTOM_RIGHT
):
pass
def
update_history
(
self
,
datasets
):
for
val
in
datasets
:
# get red value (first in tuple)
self
.
avg
[
self
.
avg_pos
]
=
val
.
red
if
self
.
source
==
"
Red
"
:
self
.
avg
[
self
.
avg_pos
]
=
val
.
red
else
:
self
.
avg
[
self
.
avg_pos
]
=
val
.
infrared
if
self
.
avg_pos
<
9
:
self
.
avg_pos
+=
1
else
:
...
...
@@ -57,6 +69,7 @@ class SPO2:
def
draw_histogram
(
self
):
self
.
disp
.
clear
(
self
.
COLOR_BACKGROUND
)
self
.
disp
.
print
(
'
Source: {0}
'
.
format
(
self
.
source
))
# offset in pause_histogram mode
window_end
=
len
(
self
.
history
)
-
self
.
histogram_offset
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment