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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Pete
firmware
Commits
ea9a5414
Commit
ea9a5414
authored
5 years ago
by
fuchsi*
Committed by
rahix
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
replace 'histogram' by 'graph' as it is not a histogram
parent
acb6085c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/apps/ecg/__init__.py
+27
-27
27 additions, 27 deletions
preload/apps/ecg/__init__.py
with
27 additions
and
27 deletions
preload/apps/ecg/__init__.py
+
27
−
27
View file @
ea9a5414
...
...
@@ -32,8 +32,8 @@ filebuffer = bytearray()
write
=
0
update_screen
=
0
pause_screen
=
0
pause_
histo
gra
m
=
False
histo
gra
m
_offset
=
0
pause_gra
ph
=
False
gra
ph
_offset
=
0
sensor
=
0
disp
=
display
.
open
()
last_sample_count
=
1
...
...
@@ -127,8 +127,8 @@ def callback_ecg(datasets):
global
update_screen
,
history
,
filebuffer
,
write
update_screen
+=
len
(
datasets
)
# update
histo
gra
m
datalist
if
not
pause_
histo
gra
m
:
# update gra
ph
datalist
if
not
pause_gra
ph
:
update_history
(
datasets
)
detect_pulse
(
len
(
datasets
))
...
...
@@ -141,7 +141,7 @@ def callback_ecg(datasets):
# don't update on every callback
if
update_screen
>=
DRAW_AFTER_SAMPLES
:
draw_
histo
gra
m
()
draw_gra
ph
()
def
append_to_file
(
fileprefix
,
content
):
...
...
@@ -221,13 +221,13 @@ def toggle_write():
def
toggle_pause
():
global
pause_
histogram
,
histo
gra
m
_offset
,
history
,
leds
if
pause_
histo
gra
m
:
pause_
histo
gra
m
=
False
global
pause_
graph
,
gra
ph
_offset
,
history
,
leds
if
pause_gra
ph
:
pause_gra
ph
=
False
history
=
[]
else
:
pause_
histo
gra
m
=
True
histo
gra
m
_offset
=
0
pause_gra
ph
=
True
gra
ph
_offset
=
0
leds
.
clear
()
...
...
@@ -269,7 +269,7 @@ def draw_leds(vmin, vmax):
leds
.
update
()
def
draw_
histo
gra
m
():
def
draw_gra
ph
():
global
disp
,
history
,
write
,
pause_screen
,
update_screen
# skip rendering due to message beeing shown
...
...
@@ -284,9 +284,9 @@ def draw_histogram():
disp
.
clear
(
COLOR_BACKGROUND
)
# offset in pause_
histo
gra
m
mode
# offset in pause_gra
ph
mode
timeWindow
=
config
.
get_option
(
"
Window
"
)
window_end
=
int
(
len
(
history
)
-
histo
gra
m
_offset
)
window_end
=
int
(
len
(
history
)
-
gra
ph
_offset
)
s_end
=
max
(
0
,
window_end
)
s_start
=
max
(
0
,
s_end
-
WIDTH
*
timeWindow
)
...
...
@@ -294,7 +294,7 @@ def draw_histogram():
value_max
=
max
(
abs
(
x
)
for
x
in
history
[
s_start
:
s_end
])
scale
=
SCALE_FACTOR
/
(
value_max
if
value_max
>
0
else
1
)
# draw
histo
gra
m
# draw gra
ph
# values need to be inverted so high values are drawn with low pixel coordinates (at the top of the screen)
draw_points
=
(
int
(
-
x
*
scale
+
OFFSET_Y
)
for
x
in
history
[
s_start
:
s_end
])
...
...
@@ -304,12 +304,12 @@ def draw_histogram():
prev
=
value
# draw text: mode/bias/write
if
pause_
histo
gra
m
:
if
pause_gra
ph
:
disp
.
print
(
"
Pause
"
+
(
"
-{:0.1f}s
"
.
format
(
histo
gra
m
_offset
/
config
.
get_option
(
"
Rate
"
))
if
histo
gra
m
_offset
>
0
"
-{:0.1f}s
"
.
format
(
gra
ph
_offset
/
config
.
get_option
(
"
Rate
"
))
if
gra
ph
_offset
>
0
else
""
),
posx
=
0
,
...
...
@@ -356,7 +356,7 @@ def draw_histogram():
def
main
():
global
pause_
histogram
,
histo
gra
m
_offset
,
pause_screen
global
pause_
graph
,
gra
ph
_offset
,
pause_screen
# show button layout
disp
.
clear
(
COLOR_BACKGROUND
)
...
...
@@ -404,11 +404,11 @@ def main():
# down
if
button_pressed
[
"
BOTTOM_LEFT
"
]
==
0
and
v
&
buttons
.
BOTTOM_LEFT
!=
0
:
button_pressed
[
"
BOTTOM_LEFT
"
]
=
1
if
pause_
histo
gra
m
:
if
pause_gra
ph
:
l
=
len
(
history
)
histo
gra
m
_offset
+=
config
.
get_option
(
"
Rate
"
)
/
2
if
l
-
histo
gra
m
_offset
<
WIDTH
*
config
.
get_option
(
"
Window
"
):
histo
gra
m
_offset
=
l
-
WIDTH
*
config
.
get_option
(
"
Window
"
)
gra
ph
_offset
+=
config
.
get_option
(
"
Rate
"
)
/
2
if
l
-
gra
ph
_offset
<
WIDTH
*
config
.
get_option
(
"
Window
"
):
gra
ph
_offset
=
l
-
WIDTH
*
config
.
get_option
(
"
Window
"
)
else
:
toggle_write
()
...
...
@@ -424,13 +424,13 @@ def main():
# down
if
button_pressed
[
"
BOTTOM_RIGHT
"
]
==
0
and
v
&
buttons
.
BOTTOM_RIGHT
!=
0
:
button_pressed
[
"
BOTTOM_RIGHT
"
]
=
1
if
pause_
histo
gra
m
:
histo
gra
m
_offset
-=
config
.
get_option
(
"
Rate
"
)
/
2
histo
gra
m
_offset
-=
histo
gra
m
_offset
%
(
if
pause_gra
ph
:
gra
ph
_offset
-=
config
.
get_option
(
"
Rate
"
)
/
2
gra
ph
_offset
-=
gra
ph
_offset
%
(
config
.
get_option
(
"
Rate
"
)
/
2
)
if
histo
gra
m
_offset
<
0
:
histo
gra
m
_offset
=
0
if
gra
ph
_offset
<
0
:
gra
ph
_offset
=
0
else
:
pause_screen
=
-
1
# hide graph
leds
.
clear
()
# disable all LEDs
...
...
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