diff options
-rw-r--r-- | mode-button-event | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mode-button-event b/mode-button-event index 66a328b..d2f5ec4 100644 --- a/mode-button-event +++ b/mode-button-event @@ -8,7 +8,12 @@ :set ($"mode-button"->"count") ($"mode-button"->"count" + 1); -:if ([ :len [ / system scheduler find where name="mode-button-scheduler" ] ] = 0) do={ - :log info "Creating mode-button scheduler..."; - / system scheduler add name=mode-button-scheduler on-event=mode-button-scheduler interval=5s; +:local scheduler [ / system scheduler find where name="mode-button-scheduler" ]; + +:if ([ :len $scheduler ] = 0) do={ + :log info "Creating mode-button scheduler, counting presses..."; + / system scheduler add name=mode-button-scheduler on-event=mode-button-scheduler interval=3s; +} else={ + :log debug "Updating mode-button-scheduler..."; + / system scheduler set $scheduler start-time=[ /system clock get time ]; } |