Messages:
+ after reset:
+ init complete
manual open key pressed:
open forced manually
t ... toggle
responce: "Ok", "Error: .*"
s ... status
- response: "Status: closed|opened|<->, opening|waiting|closing|idle"
+ response: "Status: closed|opened|<->, opening|waiting|closing|idle, ajar|shut"
or "Error: .*"
r ... reset
"Ok, closing now" or "Error: .*"
* ... everything else
Error: unknown command
- open/close will only be accepted if Status: ..., idle
+ open/close will only be accepted if Status: ..., idle, ...
otherwise response: Error: Operation in progress
unless error case s will always be accepted
current_state = CLOSING;
start_step_timer();
}
+ Serial.println("init complete");
}
void loop()
}
else if (command == CMD_OPEN) {
if(current_state == IDLE) {
- if(is_opened())
- Serial.println("Already open");
+ if(is_opened())
+ Serial.println("Already open");
else {
start_open();
Serial.println("Ok");
}
else if (command == CMD_CLOSE) {
if(current_state == IDLE) {
- if(is_closed())
- Serial.println("Already closed");
+ if(is_closed())
+ Serial.println("Already closed");
else {
start_close();
Serial.println("Ok");
}
else if (command == CMD_TOGGLE) {
if(current_state == IDLE) {
- if(is_closed())
- start_open();
- else
- start_close();
- Serial.println("Ok");
+ if(is_closed())
+ start_open();
+ else
+ start_close();
+ Serial.println("Ok");
}
else
Serial.println("Error: Operation in progress");