diff options
author | Christian Hesse <mail@eworm.de> | 2020-01-06 10:33:27 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-01-06 10:33:27 +0100 |
commit | 08c90c95b71f74a15b09c23efef484d4b471ec04 (patch) | |
tree | 9d4d63b4b51cd125ebe994db21dc49977781393a | |
parent | b3a76c7e4b5e32be9fcffdeeecfa8c61f365de22 (diff) |
mode-button-scheduler: give proper message if no action defined
-rw-r--r-- | mode-button-scheduler | 22 |
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; |