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
card10
firmware
Commits
b3d6d203
Commit
b3d6d203
authored
Oct 23, 2019
by
fleur
Browse files
i'll make my own code style it'll be terrible
parent
8f78143e
Changes
1
Hide whitespace changes
Inline
Side-by-side
preload/apps/ecg/__init__.py
View file @
b3d6d203
...
...
@@ -57,7 +57,8 @@ COLORS = [((23 + (15 * i)) % 360, 1.0, 1.0) for i in range(11)]
moving_average
=
0
alpha
=
2
beta
=
3
betadash
=
beta
/
(
alpha
+
beta
)
betadash
=
beta
/
(
alpha
+
beta
)
def
update_history
(
datasets
):
global
history
,
moving_average
,
alpha
,
beta
,
last_sample_count
...
...
@@ -65,7 +66,7 @@ def update_history(datasets):
for
val
in
datasets
:
if
current_mode
==
MODE_FINGER
:
history
.
append
(
val
-
moving_average
)
moving_average
+=
betadash
*
(
val
-
moving_average
)
moving_average
+=
betadash
*
(
val
-
moving_average
)
# identical to: moving_average = (alpha * moving_average + beta * val) / (alpha + beta)
else
:
history
.
append
(
val
)
...
...
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