Reentrant action or Do Not Disturb toggle with a timeout?

11 views
Skip to first unread message

brock

unread,
Mar 14, 2018, 12:30:52 PM3/14/18
to Tasker
I'm trying to make a Do Not Disturb toggle with a timeout. It's easy enough to make a straight toggle task, if %INTERRUPT eq "all" then set DND to None, else if %INTERRUPT eq "none" then set DND to All. However, if you want the DND None state to be on a timeout, that is, to revert to All after say 15min, then the task gets stuck on the wait action and it would appear that you can't re-run it, that is, it's non-reentrant. So, just to be clear, I want a single task to do this, so I can put a single tile in the Quick Settings pulldown area. I know I can make two separate tasks to do this, but I want one. Is this possible? Would creating a task that called a sub-task that waited also be non-reentrant?

Thanks,
-brock

Rich D

unread,
Mar 14, 2018, 12:47:16 PM3/14/18
to Tasker Google Groups Post

However, if you want the DND None state to be on a timeout, that is, to revert to All after say 15min, then the task gets stuck on the wait action and it would appear that you can't re-run it, that is, it's non-reentrant.

Ok am not familiar with the term 'non-reentrant.'  but it sounds like you want to re- enter the task while it is in the wait condition. 

You can not re- enter the task but you can re- start the task. In the Tasker edit screen click the cog icon upper right (properties ) set collision handling to 'Abort existing task'  this will kill the current running iteration of the task and allow a new iteration to run.

To achieve the 're-enter' status you could break your long wait condition into a loop with shorter wait times and include a if condition to monitor outside conditions .

1. Wait 2 seconds
2. If %Stop_loop matches 'stop'
3.         Do other stuff 
4. End if
5. Variable add  %loop=%loop+1
6.  Goto 1       if    %loop <10

Not the best sudo code but it should give you the idea.. :)



brock

unread,
Mar 14, 2018, 1:00:06 PM3/14/18
to Tasker
Thank you very much, Rich D! The collision handling settings were exactly what I was looking for.
Reply all
Reply to author
Forward
0 new messages