aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-10-11 22:39:25 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-10-11 22:39:25 +0200
commit28df37708cd047e5d36d82d9ab2d1e0f612b3eff (patch)
tree5f21e5558ed7c40edbb402c5423abd056b97aec2
parent1bbbe3a5a7dfb2b45d77e6c6c8c1f95bc533f935 (diff)
downloadrouteros-scripts-28df37708cd047e5d36d82d9ab2d1e0f612b3eff.tar.gz
routeros-scripts-28df37708cd047e5d36d82d9ab2d1e0f612b3eff.tar.xz
mode-button-event: decrease interval, but update start time
-rw-r--r--mode-button-event11
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 ];
}