From 28df37708cd047e5d36d82d9ab2d1e0f612b3eff Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 11 Oct 2018 22:39:25 +0200 Subject: [PATCH] mode-button-event: decrease interval, but update start time --- mode-button-event | 11 ++++++++--- 1 file 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 ]; }