how to reset an interval or delay timer in Dynamic C?

I have a state machine implemented with costatements in Dynamic C. I use:
waitfor (IntervalSec(duration_of_state));
to time a state duration before switching to the next state. It is also possible to switch to the next state manually from a web page. When that happens I would like to reset the timer to execute the next statements immediately. I can’t see how to do this.

Add a flag that you can set external to the delay:

bypass_delay = 0;
waitfor (IntervalSec(duration_of_state) | bypass_delay);

1 Like

That’s what I ended up doing. I also changed the IntervalSec for DelaySec and everything works fine. Thanks for the answer.