Skip to content
Snippets Groups Projects
Commit 5e26adcd authored by nicolas.albanesi's avatar nicolas.albanesi
Browse files

Added some stuff for esp com with hepialight

parent cfcb6f29
No related branches found
No related tags found
No related merge requests found
id = [0,0] id = [0,0]
matsize = [0, 0] matsize = [0, 0]
esp_dir = 0
# Display and images functions # Display and images functions
...@@ -107,6 +108,7 @@ def update_id(new_id): ...@@ -107,6 +108,7 @@ def update_id(new_id):
# Handle the commands received via UART # Handle the commands received via UART
def handle_receive(msg, msg_bytes, d): def handle_receive(msg, msg_bytes, d):
global esp_dir
print("Received from {} : {}".format(d, msg)) print("Received from {} : {}".format(d, msg))
...@@ -140,6 +142,7 @@ def handle_receive(msg, msg_bytes, d): ...@@ -140,6 +142,7 @@ def handle_receive(msg, msg_bytes, d):
x, y = msg.split(";")[-1].split(",") x, y = msg.split(";")[-1].split(",")
print("Matsize : {} {}".format(x, y)) print("Matsize : {} {}".format(x, y))
matsize = [int(x), int(y)] matsize = [int(x), int(y)]
envoyer_msg(esp_dir, "MATSIZE:{},{}".format(x, y))
elif msg.startswith("TEXT"): elif msg.startswith("TEXT"):
msgs = msg.split(";") msgs = msg.split(";")
...@@ -164,11 +167,16 @@ def handle_receive(msg, msg_bytes, d): ...@@ -164,11 +167,16 @@ def handle_receive(msg, msg_bytes, d):
elif msg == "OK": elif msg == "OK":
update_id(id) update_id(id)
esp_dir = d
# Main # Main
afficher_texte("Ready", VERT, speed=0.01) afficher_texte("Ready", VERT, speed=0.01)
# Try to find the ESP and start the initialisation
envoyer_msg(S, "ESP")
envoyer_msg(O, "ESP")
while True: while True:
for d in [N, S, E, O]: for d in [N, S, E, O]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment