From 40a91b04f102cebd67f17a4c6258cd9c0010c228 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 29 Apr 2009 21:51:16 +0000 Subject: [PATCH] no ok when forced manually --- firmware/tuer.pde | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/firmware/tuer.pde b/firmware/tuer.pde index ac1a18a..c404b74 100644 --- a/firmware/tuer.pde +++ b/firmware/tuer.pde @@ -454,32 +454,20 @@ void reset_after_error() void start_open() { - if(is_opened()) { - Serial.println("Already open"); - return; - } - reset_stepper(); reset_leds(); leds_green(); current_state = OPENING; start_step_timer(); - Serial.println("Ok"); } void start_close() { - if(is_closed()) { - Serial.println("Already closed"); - return; - } - reset_stepper(); reset_leds(); leds_red(); current_state = CLOSING; start_step_timer(); - Serial.println("Ok"); } void print_status() @@ -537,14 +525,26 @@ void loop() reset_after_error(); } else if (command == CMD_OPEN) { - if(current_state == IDLE) - start_open(); + if(current_state == IDLE) { + if(is_opened()) + Serial.println("Already open"); + else { + start_open(); + Serial.println("Ok"); + } + } else Serial.println("Error: Operation in progress"); } else if (command == CMD_CLOSE) { - if(current_state == IDLE) - start_close(); + if(current_state == IDLE) { + if(is_closed()) + Serial.println("Already closed"); + else { + start_close(); + Serial.println("Ok"); + } + } else Serial.println("Error: Operation in progress"); } -- 1.7.10.4