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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François Revol
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
No related branches found
No related tags found
No related merge requests found
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
...
@@ -8,9 +8,9 @@ import math
import
struct
import
struct
import
itertools
import
itertools
import
bluetooth
import
bluetooth
from
ecg.settings
import
*
import
ecg.settings
config
=
ecg_settings
()
config
=
ecg
.
settings
.
ecg_settings
()
WIDTH
=
160
WIDTH
=
160
HEIGHT
=
80
HEIGHT
=
80
...
@@ -89,6 +89,7 @@ class ECG:
...
@@ -89,6 +89,7 @@ class ECG:
self
.
disp
.
backlight
(
0
)
self
.
disp
.
backlight
(
0
)
def
__init__
(
self
):
def
__init__
(
self
):
try
:
self
.
b
=
bluetooth
.
BLE
()
self
.
b
=
bluetooth
.
BLE
()
self
.
b
.
active
(
True
)
self
.
b
.
active
(
True
)
self
.
b
.
irq
(
self
.
ble_irq
)
self
.
b
.
irq
(
self
.
ble_irq
)
...
@@ -106,6 +107,9 @@ class ECG:
...
@@ -106,6 +107,9 @@ class ECG:
# Disable streaming by default
# Disable streaming by default
self
.
ble_streaming
=
False
self
.
ble_streaming
=
False
self
.
b
.
gatts_write
(
self
.
ecg_cccd_handle
,
"
\x00\x00
"
)
self
.
b
.
gatts_write
(
self
.
ecg_cccd_handle
,
"
\x00\x00
"
)
except
OSError
:
self
.
ble_streaming
=
False
pass
leds
.
dim_top
(
1
)
leds
.
dim_top
(
1
)
...
@@ -169,15 +173,11 @@ class ECG:
...
@@ -169,15 +173,11 @@ class ECG:
def
callback_ecg
(
self
,
datasets
):
def
callback_ecg
(
self
,
datasets
):
if
self
.
ble_streaming
:
if
self
.
ble_streaming
:
# try:
if
1
:
self
.
b
.
gatts_notify
(
self
.
b
.
gatts_notify
(
1
,
1
,
self
.
ecg_data_handle
,
self
.
ecg_data_handle
,
struct
.
pack
(
"
>
"
+
(
"
h
"
*
len
(
datasets
)),
*
datasets
),
struct
.
pack
(
"
>
"
+
(
"
h
"
*
len
(
datasets
)),
*
datasets
),
)
)
# except:
pass
# Don't update the screen if it should be off during a connection
# Don't update the screen if it should be off during a connection
if
not
config
.
get_option
(
"
BLE Disp
"
):
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