From 1e5fc119ad4dbdb6c29223cd6bf542507e03cb15 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Tue, 25 Jun 2024 17:34:41 +0200 Subject: [PATCH] refactor(server): :recycle: reduce code duplication --- server/commande_telephone.ino | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/server/commande_telephone.ino b/server/commande_telephone.ino index cbb65aa..2820cde 100644 --- a/server/commande_telephone.ino +++ b/server/commande_telephone.ino @@ -59,7 +59,8 @@ void loop() return; // Arrêter le robot si une commande est interrompue - if (stopCommand) + // ou si le nombre de pas a été effectué + if (stopCommand || globalValue <= 0) { Serial.println("stop"); commandRunning = false; @@ -77,13 +78,6 @@ void loop() Serial.println(globalValue); globalValue--; } - else - { // Sinon on stoppe les moteurs - Serial.println("stop"); - commandRunning = false; - stopCommand = false; - stopMotors(); - } } // Configuration du serveur asynchrone