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
8f488267
Commit
8f488267
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Plain Diff
Merge branch 'electrodes' into 'master'
electrodes unfiltered See merge request
!347
parents
3cc52e92
b3d6d203
No related branches found
No related tags found
1 merge request
!347
electrodes unfiltered
Pipeline
#4184
passed
5 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/apps/ecg/__init__.py
+9
-3
9 additions, 3 deletions
preload/apps/ecg/__init__.py
with
9 additions
and
3 deletions
preload/apps/ecg/__init__.py
+
9
−
3
View file @
8f488267
...
...
@@ -51,19 +51,25 @@ last_sample_count = 1
leds
.
dim_top
(
1
)
COLORS
=
[((
23
+
(
15
*
i
))
%
360
,
1.0
,
1.0
)
for
i
in
range
(
11
)]
# variables for high-pass filter
# note: corresponds to 1st order hpf with -3dB at ~18.7Hz
# general formula: f(-3dB)=-(sample_rate/tau)*ln(1-betadash)
moving_average
=
0
alpha
=
2
beta
=
3
betadash
=
beta
/
(
alpha
+
beta
)
def
update_history
(
datasets
):
global
history
,
moving_average
,
alpha
,
beta
,
last_sample_count
last_sample_count
=
len
(
datasets
)
for
val
in
datasets
:
history
.
append
(
val
-
moving_average
)
moving_average
=
(
alpha
*
moving_average
+
beta
*
val
)
/
(
alpha
+
beta
)
if
current_mode
==
MODE_FINGER
:
history
.
append
(
val
-
moving_average
)
moving_average
+=
betadash
*
(
val
-
moving_average
)
# identical to: moving_average = (alpha * moving_average + beta * val) / (alpha + beta)
else
:
history
.
append
(
val
)
# trim old elements
history
=
history
[
-
HISTORY_MAX
:]
...
...
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