Terminate a wakeup?

Assuming i have a function which calls itself every 60secs.
and i call it outside from another place, to start the sequence…
is it possible to stop it from outside, some sort of kill signal?
thats because in some event i reinitiate the call to this function, having it twice in a wakeup mechanism…so it updates twice instead of once.
I can add a variable, but if it changes too quickly i cant tell if i need to stop or continue.
the other way to make it work is to use wakeup for a function with variable, but it doesnt seem to work.
i tried imp.wakeup(60,func(x)), but it fails

i tried imp.wakeup(60,func(x)), but it fails

You aren’t the first to have that problem: I added the answer to the imp.wakeup page on the devwiki (though our other callbacks, for GPIO and for UART, behave similarly).

Peter

Thanks Peter,
I tried imp.wakeup(60,timeIncrement() { c } );
where timeIncrement receives c as a parameter.
but i get error expected '=' error. I tried both c or c;
thats according to imp.wakeup(30.0, function() { server.log("Rise and shine!"); } );

Ah, “function” is a Squirrel keyword; it’s not the name of the lambda function, which is anonymous.

Is this what you’re trying to do?

imp.wakeup(60, function() { timeIncrement(c); } );

Peter

Yes,
thats perfect. tnx