Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fleur
firmware
Commits
ba0fb6bc
Commit
ba0fb6bc
authored
Aug 27, 2019
by
Rahix
Browse files
Merge 'Add led activity to ECG app'
See merge request
card10/firmware!261
parents
1d21f7c1
bc7e3b92
Changes
1
Hide whitespace changes
Inline
Side-by-side
preload/apps/ecg/__init__.py
View file @
ba0fb6bc
import
os
import
display
import
leds
import
utime
import
buttons
import
max30001
...
...
@@ -36,6 +37,10 @@ histogram_offset = 0
sensor
=
0
disp
=
display
.
open
()
leds
.
dim_top
(
1
)
COLORS
=
[((
23
+
(
15
*
i
))
%
360
,
1.0
,
1.0
)
for
i
in
range
(
11
)]
colors
=
COLORS
def
callback_ecg
(
datasets
):
global
update_screen
,
history
,
filebuffer
,
write
...
...
@@ -161,6 +166,14 @@ def toggle_pause():
histogram_offset
=
0
def
draw_leds
(
val
):
global
colors
# val should be in [0, 11]
for
i
in
range
(
11
):
leds
.
prep_hsv
(
10
-
i
,
COLORS
[
10
-
i
]
if
i
<
val
else
(
0
,
0
,
0
))
leds
.
update
()
def
draw_histogram
():
global
disp
,
history
,
current_mode
,
bias
,
write
,
pause_screen
,
update_screen
...
...
@@ -211,6 +224,7 @@ def draw_histogram():
old
=
value
x
+=
1
draw_leds
((
60
-
int
((
max
(
history
[
-
3
:])
*
scale
+
OFFSET
)
-
20
))
*
11
/
60
)
# draw text: mode/bias/write
if
pause_histogram
==
True
:
disp
.
print
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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