diff --git a/hepialight/main.py b/hepialight/main.py index 4384b2ffd2d7fe6426f2e13e0698a1fc2b6845c1..32ba92e2668ac66a9be2b3f2544e284912039184 100644 --- a/hepialight/main.py +++ b/hepialight/main.py @@ -1,5 +1,6 @@ id = [0,0] matsize = [0, 0] +esp_dir = 0 # Display and images functions @@ -107,6 +108,7 @@ def update_id(new_id): # Handle the commands received via UART def handle_receive(msg, msg_bytes, d): + global esp_dir print("Received from {} : {}".format(d, msg)) @@ -140,6 +142,7 @@ def handle_receive(msg, msg_bytes, d): x, y = msg.split(";")[-1].split(",") print("Matsize : {} {}".format(x, y)) matsize = [int(x), int(y)] + envoyer_msg(esp_dir, "MATSIZE:{},{}".format(x, y)) elif msg.startswith("TEXT"): msgs = msg.split(";") @@ -164,11 +167,16 @@ def handle_receive(msg, msg_bytes, d): elif msg == "OK": update_id(id) + esp_dir = d # Main 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: for d in [N, S, E, O]: