From: realraum Date: Fri, 1 May 2009 23:08:53 +0000 (+0000) Subject: added toggel command to firmware X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=33de7447b0fab42ac6a65fa614a2ae3fe28d5788;p=svn42.git added toggel command to firmware --- diff --git a/firmware-messages.txt b/firmware-messages.txt index e056a29..cf16cea 100644 --- a/firmware-messages.txt +++ b/firmware-messages.txt @@ -21,6 +21,8 @@ response: "Ok", "Already closed", "Error: .*" o ... open response: "Ok", "Already opened", "Error: .*" + t ... toggle + responce: "Ok", "Error: .*" s ... status response: "Status: closed|opened|<->, opening|waiting|closing|idle" or "Error: .*" diff --git a/firmware/tuer.pde b/firmware/tuer.pde index ddf8ba3..d2c7a09 100644 --- a/firmware/tuer.pde +++ b/firmware/tuer.pde @@ -38,6 +38,7 @@ int debounce_cnt = 0; #define CMD_OPEN 'o' #define CMD_CLOSE 'c' +#define CMD_TOGGLE 't' #define CMD_STATUS 's' #define CMD_RESET 'r' @@ -554,6 +555,17 @@ void loop() else Serial.println("Error: Operation in progress"); } + else if (command == CMD_TOGGLE) { + if(current_state == IDLE) { + if(is_closed()) + start_open(); + else + start_close(); + Serial.println("Ok"); + } + else + Serial.println("Error: Operation in progress"); + } else if (command == CMD_STATUS) print_status(); else