On 11 November 2015 at 05:21, Marius Liebenberg <[email protected]> wrote:
> The question is what is the best way to do the timeout inside the case
> statement. Any place to look at a sample will help as well.
I can't find an example, but I know that I have coded it a few times.
It looks a bit like
float timeout;
int state;
switch(state){
case IDLE:
if (condition){
state = STATE1
timeout = 2
}
break;
case STATE1:
timeout -= fperiod;
if (timeout <= 0) {
state = STATE_TIMEOUT
}
if (condition2){
state = STATE2;
timeout = 3.1416;
}
break;
case STATE2:
timeout -= fperiod;
....
case STATE_TIMEOUT:
STATE = IDLE;
{Report error}
--
atp
If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto
------------------------------------------------------------------------------
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers