mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-10 05:04:47 +02:00
mode-button: use $ValidateSyntax
This commit is contained in:
parent
e76b52e3b0
commit
cf87be70f9
1 changed files with 15 additions and 10 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global ModeButtonScheduler;
|
:global ModeButtonScheduler;
|
||||||
|
:global ValidateSyntax;
|
||||||
|
|
||||||
:local LEDInvert do={
|
:local LEDInvert do={
|
||||||
:global ModeButtonLED;
|
:global ModeButtonLED;
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
/ system scheduler remove ModeButtonScheduler;
|
/ system scheduler remove ModeButtonScheduler;
|
||||||
|
|
||||||
:if ([ :len $Code ] > 0) do={
|
:if ([ :len $Code ] > 0) do={
|
||||||
|
:if ([ $ValidateSyntax $Code ] = true) do={
|
||||||
$LogPrintExit2 info $0 ("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={
|
:for I from=1 to=$Count do={
|
||||||
|
@ -59,6 +61,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[ :parse $Code ];
|
[ :parse $Code ];
|
||||||
|
} else={
|
||||||
|
$LogPrintExit2 warning $0 ("The code for " . $Count . " mode-button presses failed syntax validation!") false;
|
||||||
|
}
|
||||||
} else={
|
} else={
|
||||||
$LogPrintExit2 info $0 ("No action defined for " . $Count . " mode-button presses.") false;
|
$LogPrintExit2 info $0 ("No action defined for " . $Count . " mode-button presses.") false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue