This commit is contained in:
bsongis
2014-05-20 14:32:27 +02:00
parent b3a6556e0b
commit a178d6b326
+11 -5
View File
@@ -329,22 +329,28 @@ bool getLogicalSwitch(uint8_t idx)
context.timerState = SWITCH_DELAY;
context.timer = ls->delay;
}
if (context.timerState == SWITCH_DELAY) {
if (context.timer) {
result = false; //return false while delay timer running
result = false; // return false while delay timer running
}
else if (ls->duration) {
else {
// set duration timer
context.timerState = SWITCH_ENABLE;
context.timer = ls->duration;
}
}
else if (context.timerState == SWITCH_ENABLE) {
result = (context.timer > 0); //return false after duration timer runs out
if (context.timerState == SWITCH_ENABLE) {
result = (ls->duration==0 || context.timer>0); // return false after duration timer runs out
}
}
else {
else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && context.timer > 0) {
result = true;
}
else {
context.timerState = SWITCH_START;
context.timer = 0;
}
}
#endif