Escaping waitpeq or pne
T Chap
Posts: 4,223
I heard a trick once about connecting a prop pin to another pin to create an escape route by another cog. But, what about having another cog go to the Dira and change the pin to an output and set it high or low and escape as well?
Comments
Perfectly OK. As long as the waitpxx listens to it you can use any arrangement you want. Careful with setting it low though. It's OR logic so if the pin is high already it won't change.
I usually sacrifice a second (timeout) pin and connect a counter to it.
do the ping check in another cog, and have the "primary cog" wait for an appropriate signal from the "check the ping cog" to indicate a ping was found on board -- if the signal does not come, then kill the secondary cog and assume the ping is MIA
This will need some code to tell the caller that there was no PING found if that is the case, so it does not try to calculate the duration.