aboutsummaryrefslogtreecommitdiffstats
path: root/mode-button-scheduler
diff options
context:
space:
mode:
Diffstat (limited to 'mode-button-scheduler')
-rw-r--r--mode-button-scheduler22
1 files changed, 13 insertions, 9 deletions
diff --git a/mode-button-scheduler b/mode-button-scheduler
index 2873398..2b6f083 100644
--- a/mode-button-scheduler
+++ b/mode-button-scheduler
@@ -8,20 +8,24 @@
:local Count ($ModeButton->"count");
:local Code ($ModeButton->[ :tostr $Count ]);
-:local Parsed [ :parse $Code ];
:set ($ModeButton->"count") 0;
/ system scheduler remove mode-button-scheduler;
-:log info ("Acting on " . $Count . " mode-button presses: " . $Code);
+:if ([ :len $Code ] > 0) do={
+ :log info ("Acting on " . $Count . " mode-button presses: " . $Code);
-:if ([ / system routerboard settings get silent-boot ] = false) do={
- :for I from=1 to=$Count do={
- :beep length=200ms;
- :delay 200ms;
+ :if ([ / system routerboard settings get silent-boot ] = false) do={
+ :for I from=1 to=$Count do={
+ :beep length=200ms;
+ :delay 200ms;
+ }
+ } else={
+ :delay 1s;
}
+
+ :local Parsed [ :parse $Code ];
+ $Parsed;
} else={
- :delay 1s;
+ :log info ("No action defined for " . $Count . " mode-button presses.");
}
-
-$Parsed;