Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
François Revol
firmware
Commits
7e8f17f0
Commit
7e8f17f0
authored
Jun 18, 2020
by
schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ble): Better bonding UI
parent
b2d78fea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
preload/apps/ble/__init__.py
preload/apps/ble/__init__.py
+15
-8
No files found.
preload/apps/ble/__init__.py
View file @
7e8f17f0
...
...
@@ -108,8 +108,12 @@ while True:
# print confirmation value
compare_value
=
sys_ble
.
get_compare_value
()
disp
.
clear
()
disp
.
print
(
"confirm:"
,
posy
=
0
,
fg
=
[
0
,
255
,
255
])
disp
.
print
(
"%06d"
%
compare_value
,
posy
=
20
,
fg
=
[
255
,
0
,
0
])
disp
.
print
(
"BLE: Bond?"
,
posy
=
0
,
fg
=
[
0
,
0
,
255
])
disp
.
print
(
"Code:"
,
posy
=
20
,
fg
=
[
0
,
255
,
255
])
disp
.
print
(
" %06d"
%
compare_value
,
posy
=
40
,
fg
=
[
255
,
255
,
255
])
disp
.
print
(
"Yes"
,
posy
=
60
,
fg
=
[
0
,
255
,
0
])
disp
.
print
(
"No"
,
posx
=
120
,
posy
=
60
,
fg
=
[
255
,
0
,
0
])
disp
.
update
()
state
=
4
elif
state
==
4
:
...
...
@@ -117,15 +121,16 @@ while True:
if
ble_event
==
sys_ble
.
EVENT_PAIRING_FAILED
:
ble_event
=
None
state
=
6
if
v
&
buttons
.
BOTTOM_
RIGH
T
:
if
v
&
buttons
.
BOTTOM_
LEF
T
:
sys_ble
.
confirm_compare_value
(
True
)
disp
.
clear
()
disp
.
print
(
"Wait"
,
posy
=
0
,
fg
=
[
0
,
255
,
255
])
disp
.
print
(
"BLE Bonding"
,
posy
=
0
,
fg
=
[
0
,
0
,
255
])
disp
.
print
(
"Please Wait"
,
posy
=
40
,
fg
=
[
255
,
255
,
255
])
disp
.
update
()
state
=
5
elif
v
&
buttons
.
BOTTOM_
LEFT
:
elif
v
&
(
buttons
.
BOTTOM_
RIGHT
|
buttons
.
TOP_RIGHT
)
:
sys_ble
.
confirm_compare_value
(
False
)
state
=
1
state
=
6
elif
state
==
5
:
# Wait for pairing to complete
...
...
@@ -135,7 +140,8 @@ while True:
elif
ble_event
==
sys_ble
.
EVENT_PAIRING_COMPLETE
:
ble_event
=
None
disp
.
clear
()
disp
.
print
(
"OK"
,
posy
=
0
,
fg
=
[
0
,
255
,
255
])
disp
.
print
(
"BLE Bonding"
,
posy
=
0
,
fg
=
[
0
,
0
,
255
])
disp
.
print
(
" Success"
,
posy
=
40
,
fg
=
[
0
,
255
,
0
])
disp
.
update
()
time
.
sleep
(
5
)
state
=
1
...
...
@@ -143,7 +149,8 @@ while True:
elif
state
==
6
:
# display fail screen and wait 5 seconds
disp
.
clear
()
disp
.
print
(
"Fail"
,
posy
=
0
,
fg
=
[
0
,
255
,
255
])
disp
.
print
(
"BLE Bonding"
,
posy
=
0
,
fg
=
[
0
,
0
,
255
])
disp
.
print
(
" Fail"
,
posy
=
40
,
fg
=
[
255
,
0
,
0
])
disp
.
update
()
time
.
sleep
(
5
)
state
=
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