Some problems with Arduino protothreads

In irthread() the second argument to macro PT_WAIT_UNTIL always evaluates to true:

PT_WAIT_UNTIL(pt, 1>0);

Thus the program will be stuck in irthread()'s infinite loop, because part of the result of macro PT_WAIT_UNTIL in this case is something like if(!(1>0)) return 0;; the statement return 0 is never called.


It works for usthread() and leggithread() as the second argument is false for the first 200 milliseconds and the variables are set up so it will be false again for another 200 milliseconds after being true for a single time.

Some background information is in How protothreads really work.