X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=firmware%2Ftuer.pde;h=c404b74f82a57e4b7a544dcdecb4aac4bdce79b0;hb=40a91b04f102cebd67f17a4c6258cd9c0010c228;hp=ac1a18ac694608d3116c2d6f093a58f98e43b60a;hpb=d269d3bba2ae1605ce94bb9cc3384da058656846;p=svn42.git 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"); }