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
ae08d2f9
Commit
ae08d2f9
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(exno): Save config
parent
aadcb133
No related branches found
Branches containing commit
No related tags found
1 merge request
!392
Show COVID-19 exposure notification statistics
Pipeline
#4666
passed
4 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
preload/apps/exnostat/__init__.py
+24
-11
24 additions, 11 deletions
preload/apps/exnostat/__init__.py
with
24 additions
and
11 deletions
preload/apps/exnostat/__init__.py
+
24
−
11
View file @
ae08d2f9
...
...
@@ -6,6 +6,7 @@ import display
import
color
import
buttons
import
leds
import
config
DM_ADV_TYPE_FLAGS
=
0x01
DM_ADV_TYPE_16_UUID
=
0x03
...
...
@@ -19,8 +20,8 @@ MODE_ON_RX = 2
MODE_BOTH
=
3
seen
=
{}
vib_mode
=
MODE_
OFF
led_mode
=
MODE_
OFF
vib_mode
=
MODE_
BOTH
led_mode
=
MODE_
BOTH
def
parse_advertisement_data
(
data
):
...
...
@@ -100,12 +101,13 @@ def process_scan_report(scan_report):
def
ble_callback
(
_
):
event
=
sys_ble
.
get_event
()
prune
()
while
True
:
scan_report
=
sys_ble
.
get_scan_report
()
if
scan_report
==
None
:
return
process_scan_report
(
scan_report
)
if
event
==
sys_ble
.
EVENT_SCAN_REPORT
:
while
True
:
scan_report
=
sys_ble
.
get_scan_report
()
if
scan_report
==
None
:
break
process_scan_report
(
scan_report
)
prune
()
def
show_stats
():
...
...
@@ -139,7 +141,6 @@ def show_stats():
disp
.
update
()
t0
=
time
.
time
()
last_rx_time
=
0
disp
=
display
.
open
()
v_old
=
0
...
...
@@ -148,6 +149,15 @@ pause = 1
interrupt
.
set_callback
(
interrupt
.
BLE
,
ble_callback
)
interrupt
.
enable_callback
(
interrupt
.
BLE
)
try
:
vib_mode
=
int
(
config
.
get_string
(
"
exno_vib_mode
"
))
except
:
pass
try
:
led_mode
=
int
(
config
.
get_string
(
"
exno_led_mode
"
))
except
:
pass
disp
.
clear
()
disp
.
print
(
"
Exp Notif
"
,
posy
=
0
,
fg
=
color
.
WHITE
)
...
...
@@ -158,6 +168,7 @@ disp.update()
time
.
sleep
(
3
)
t0
=
time
.
time
()
sys_ble
.
scan_start
()
while
True
:
...
...
@@ -182,8 +193,9 @@ while True:
elif
vib_mode
==
MODE_BOTH
:
vib_mode
=
MODE_OFF
disp
.
print
(
"
Vib off
"
,
posy
=
40
,
fg
=
color
.
WHITE
)
disp
.
update
()
config
.
set_string
(
"
exno_vib_mode
"
,
str
(
vib_mode
))
pause
=
20
if
v
&
buttons
.
BOTTOM_LEFT
:
...
...
@@ -203,8 +215,9 @@ while True:
elif
led_mode
==
MODE_BOTH
:
led_mode
=
MODE_OFF
disp
.
print
(
"
LED off
"
,
posy
=
40
,
fg
=
color
.
WHITE
)
disp
.
update
()
config
.
set_string
(
"
exno_led_mode
"
,
str
(
led_mode
))
pause
=
20
pause
-=
1
...
...
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