Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
François Revol
firmware
Commits
ae08d2f9
Commit
ae08d2f9
authored
Jun 28, 2020
by
schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(exno): Save config
parent
aadcb133
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
preload/apps/exnostat/__init__.py
preload/apps/exnostat/__init__.py
+24
-11
No files found.
preload/apps/exnostat/__init__.py
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
...
...
Write
Preview
Markdown
is supported
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