Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Open-Cube FW
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Cube
Open-Cube FW
Commits
68731ce2
Commit
68731ce2
authored
5 months ago
by
Václav Jelínek
Browse files
Options
Downloads
Patches
Plain Diff
Make esp menu reset smoother
parent
bf400d2a
No related branches found
No related tags found
1 merge request
!12
Major update of menu visuals and example programs
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
main/main.py
+5
-1
5 additions, 1 deletion
main/main.py
menu_programs/__init__.py
+1
-0
1 addition, 0 deletions
menu_programs/__init__.py
programs/examples/oc/esp_wifi.py
+0
-45
0 additions, 45 deletions
programs/examples/oc/esp_wifi.py
with
6 additions
and
46 deletions
main/main.py
+
5
−
1
View file @
68731ce2
...
...
@@ -49,7 +49,8 @@ def main():
MENU_PROGRAM_NXT_UTZ_IDX
=
3
menu_programs_functions_size
=
len
(
menu_programs_functions
)
menu_list
=
[
0
,
0
,
0
,
0
,
0
,
0
]
menu_list_size
=
[
0
,
Port
.
M_COUNT
,
menu_programs_functions_size
,
2
,
1
,
Port
.
S_COUNT
]
MENU_CUBE_TESTS
=
3
menu_list_size
=
[
0
,
Port
.
M_COUNT
,
menu_programs_functions_size
,
MENU_CUBE_TESTS
,
1
,
Port
.
S_COUNT
]
SENSOR_TEST_MENU_PORT_IDX
=
5
# Fill framebuffer with battery voltage
...
...
@@ -371,6 +372,9 @@ def main():
elif
menu_list
[
current_menu
]
==
1
:
print
(
"
Utility tets
"
)
menu_programs
.
cube_utility_run
(
robot
)
elif
menu_list
[
current_menu
]
==
2
:
print
(
"
Wifi webserver test
"
)
menu_programs
.
esp_wifi_run
(
robot
,
esp_default_name
)
robot
.
deinit_all
()
robot_state
=
0
menu_debounce
=
1
...
...
This diff is collapsed.
Click to expand it.
menu_programs/__init__.py
+
1
−
0
View file @
68731ce2
# Helper file for importing menu programs
from
.cube_gyro_acc
import
cube_gyro_acc_run
from
.cube_utility
import
cube_utility_run
from
.esp_wifi
import
esp_wifi_run
from
.motor
import
motor_run
from
.nxt_light
import
nxt_light_run
from
.nxt_sound
import
nxt_sound_run
...
...
This diff is collapsed.
Click to expand it.
programs/examples/oc/esp_wifi.py
deleted
100644 → 0
+
0
−
45
View file @
bf400d2a
'''
Example program for the Open-Cube ESP32 Wi-Fi mode with web server.
Start Wi-Fi acces point on the ESP32 with name
'
Open-Cube-Wifi
'
and password
'
01234567
'
.
'''
import
utime
import
random
from
lib.robot_consts
import
Button
def
main
():
global
robot
counter
=
0
indicators
=
[
True
,
False
,
True
,
False
,
False
]
labels
=
[
"
1
"
,
"
test1
"
,
"
test2
"
,
""
,
"
123
"
]
btn_labels
=
[
""
,
"
up
"
,
""
,
"
left
"
,
"
ok
"
,
"
right
"
,
""
,
"
down
"
,
""
]
run
=
True
while
run
:
time
=
utime
.
ticks_us
()
wifi
=
robot
.
esp
.
wifi
()
if
wifi
:
break
print
(
"
Name:
"
,
robot
.
esp
.
set_name
(
"
Open-Cube-Wifi
"
))
print
(
"
Password:
"
,
robot
.
esp
.
set_password
(
"
01234567
"
))
robot
.
esp
.
wifi_set_indicators_labels
((
"
1
"
,
""
,
"
test2
"
,
"
test3
"
,
"
123
"
))
robot
.
esp
.
wifi_set_buttons_labels
(
btn_labels
)
robot
.
esp
.
wifi_set_switches_labels
(
labels
)
robot
.
esp
.
wifi_set_numbers_labels
((
"
t:
"
,
"
s:
"
,
"
v:
"
,
"
test1:
"
,
""
,
"
test2:
"
))
while
run
:
utime
.
sleep
(
0.1
)
if
counter
%
10
==
0
:
robot
.
esp
.
wifi_set_indicators
(
indicators
)
robot
.
esp
.
wifi_set_numbers
((
123456789
,
0.123456
,
random
.
random
(),
0.123456
,
random
.
random
(),
5.2
))
indicators
=
indicators
[
-
1
:]
+
indicators
[:
-
1
]
print
(
"
Buttons:
"
,
robot
.
esp
.
wifi_get_buttons
())
print
(
"
Switches:
"
,
robot
.
esp
.
wifi_get_switches
())
counter
+=
1
buttons
=
robot
.
buttons
.
pressed
()
if
buttons
[
Button
.
LEFT
]:
run
=
False
main
()
\ No newline at end of file
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