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
b9f35c42
Commit
b9f35c42
authored
3 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
ecg: handle ble inactive exception
parent
94cc9f71
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!493
feat(ecg): Experimental streaming of ECG samples via BLE
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/apps/ecg/__init__.py
+26
-26
26 additions, 26 deletions
preload/apps/ecg/__init__.py
with
26 additions
and
26 deletions
preload/apps/ecg/__init__.py
+
26
−
26
View file @
b9f35c42
...
...
@@ -8,9 +8,9 @@ import math
import
struct
import
itertools
import
bluetooth
from
ecg.settings
import
*
import
ecg.settings
config
=
ecg_settings
()
config
=
ecg
.
settings
.
ecg_settings
()
WIDTH
=
160
HEIGHT
=
80
...
...
@@ -89,6 +89,7 @@ class ECG:
self
.
disp
.
backlight
(
0
)
def
__init__
(
self
):
try
:
self
.
b
=
bluetooth
.
BLE
()
self
.
b
.
active
(
True
)
self
.
b
.
irq
(
self
.
ble_irq
)
...
...
@@ -106,6 +107,9 @@ class ECG:
# Disable streaming by default
self
.
ble_streaming
=
False
self
.
b
.
gatts_write
(
self
.
ecg_cccd_handle
,
"
\x00\x00
"
)
except
OSError
:
self
.
ble_streaming
=
False
pass
leds
.
dim_top
(
1
)
...
...
@@ -169,15 +173,11 @@ class ECG:
def
callback_ecg
(
self
,
datasets
):
if
self
.
ble_streaming
:
# try:
if
1
:
self
.
b
.
gatts_notify
(
1
,
self
.
ecg_data_handle
,
struct
.
pack
(
"
>
"
+
(
"
h
"
*
len
(
datasets
)),
*
datasets
),
)
# except:
pass
# Don't update the screen if it should be off during a connection
if
not
config
.
get_option
(
"
BLE Disp
"
):
...
...
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