diff options
Diffstat (limited to 'mode-button')
-rw-r--r-- | mode-button | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mode-button b/mode-button index cd94919..8d96fcd 100644 --- a/mode-button +++ b/mode-button @@ -6,23 +6,24 @@ # act on multiple mode and reset button presses # https://git.eworm.de/cgit/routeros-scripts/about/doc/mode-button.md +:local 0 "mode-button"; :global GlobalFunctionsReady; :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :global ModeButton; -:global LogPrintExit; +:global LogPrintExit2; :set ($ModeButton->"count") ($ModeButton->"count" + 1); :local Scheduler [ / system scheduler find where name="ModeButtonScheduler" ]; :if ([ :len $Scheduler ] = 0) do={ - $LogPrintExit info ("Creating scheduler ModeButtonScheduler, counting presses...") false; + $LogPrintExit2 info $0 ("Creating scheduler ModeButtonScheduler, counting presses...") false; :global ModeButtonScheduler do={ :global ModeButton; - :global LogPrintExit; + :global LogPrintExit2; :global ModeButtonScheduler; :local LEDInvert do={ @@ -45,7 +46,7 @@ / system scheduler remove ModeButtonScheduler; :if ([ :len $Code ] > 0) do={ - $LogPrintExit info ("Acting on " . $Count . " mode-button presses: " . $Code) false; + $LogPrintExit2 info $0 ("Acting on " . $Count . " mode-button presses: " . $Code) false; :for I from=1 to=$Count do={ $LEDInvert; @@ -59,12 +60,12 @@ [ :parse $Code ]; } else={ - $LogPrintExit info ("No action defined for " . $Count . " mode-button presses.") false; + $LogPrintExit2 info $0 ("No action defined for " . $Count . " mode-button presses.") false; } } / system scheduler add name="ModeButtonScheduler" \ on-event=":global ModeButtonScheduler; \$ModeButtonScheduler;" interval=3s; } else={ - $LogPrintExit debug ("Updating scheduler ModeButtonScheduler...") false; + $LogPrintExit2 debug $0 ("Updating scheduler ModeButtonScheduler...") false; / system scheduler set $Scheduler start-time=[ /system clock get time ]; } |