Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uni_ete_hepialight_mqtt
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
jonas.stirnema
uni_ete_hepialight_mqtt
Commits
af042c53
Commit
af042c53
authored
1 year ago
by
nicolas.albanesi
Browse files
Options
Downloads
Patches
Plain Diff
moving text working when the hepialight is not broken
parent
29296157
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
merge Nico
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mapping/main.py
+39
-8
39 additions, 8 deletions
mapping/main.py
with
39 additions
and
8 deletions
mapping/main.py
+
39
−
8
View file @
af042c53
id
=
[
0
,
0
]
matsize
=
[
0
,
0
]
def
display_id
():
afficher_texte
(
"
{}, {}
"
.
format
(
id
[
0
],
id
[
1
]),
speed
=
0.01
)
...
...
@@ -24,16 +25,23 @@ def send_passthrough(msg, x, y):
def
send_xy
(
x
,
y
,
msg
):
send_passthrough
(
msg
,
x
,
y
)
def
send_text_xy
(
x
,
y
,
text
,
color
=
ROUGE
,
speed
=
0.1
):
send_xy
(
x
,
y
,
"
TEXT;{};{};{}
"
.
format
(
color
,
speed
,
text
))
def
send_moving_xy
(
x
,
y
,
text
,
color
=
ROUGE
,
speed
=
0.1
):
send_xy
(
x
,
y
,
"
MOVING;{};{};{}
"
.
format
(
color
,
speed
,
text
))
def
check_presence
(
d
):
envoyer_msg
(
d
,
"
PING
"
)
time
.
sleep
(
0.05
)
ret
=
recevoir_msg
(
d
)
print
(
"
checking pres for {} : {}
"
.
format
(
d
,
ret
))
for
x
in
range
(
10
):
time
.
sleep
(
0.1
)
ret
=
recevoir_msg
(
d
)
if
ret
==
b
""
:
return
Fals
e
if
ret
==
b
"
PONG
"
:
return
Tru
e
return
Tru
e
return
Fals
e
def
update_id
(
new_id
):
...
...
@@ -52,6 +60,8 @@ def update_id(new_id):
def
handle_receive
(
msg
,
d
):
print
(
"
Received from {} : {}
"
.
format
(
d
,
msg
))
if
msg
.
startswith
(
"
SET_ID
"
):
tmp_id
=
msg
[
7
:].
split
(
"
,
"
)
update_id
(
tmp_id
)
...
...
@@ -63,9 +73,9 @@ def handle_receive(msg, d):
display_id
()
elif
msg
.
startswith
(
"
PT;
"
):
print
(
msg
)
msgs
=
msg
.
split
(
"
;
"
)
m
=
msgs
[
2
]
m
=
msgs
[
2
:]
m
=
"
;
"
.
join
(
m
)
x
,
y
=
msgs
[
1
].
split
(
"
,
"
)
x
=
int
(
x
)
...
...
@@ -77,12 +87,33 @@ def handle_receive(msg, d):
send_passthrough
(
m
,
x
,
y
)
elif
msg
.
startswith
(
"
MATSIZE
"
):
x
,
y
=
msg
.
split
(
"
:
"
)[
-
1
].
split
(
"
,
"
)
print
(
"
Matsize : {} {}
"
.
format
(
x
,
y
))
matsize
=
[
int
(
x
),
int
(
y
)]
elif
msg
.
startswith
(
"
TEXT
"
):
msgs
=
msg
.
split
(
"
;
"
)
color
=
int
(
msgs
[
1
])
speed
=
float
(
msgs
[
2
])
afficher_texte
(
msgs
[
3
],
color
,
speed
)
elif
msg
.
startswith
(
"
MOVING
"
):
msgs
=
msg
.
split
(
"
;
"
)
color
=
int
(
msgs
[
1
])
speed
=
float
(
msgs
[
2
])
text
=
msgs
[
3
]
time
.
sleep
(
speed
*
11
)
send_moving_xy
(
id
[
0
]
-
1
,
id
[
1
],
text
,
color
=
color
,
speed
=
speed
)
afficher_texte
(
text
,
color
,
speed
)
# Main
# send_text_xy(1,0,text,speed=speed);time.sleep(speed*13);afficher_texte(text,speed=speed)
# Main
afficher_texte
(
"
Ready
"
,
VERT
,
speed
=
0.01
)
while
True
:
...
...
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