mode-button: use $ValidateSyntax

This commit is contained in:
Christian Hesse 2021-02-26 16:01:39 +01:00
parent e76b52e3b0
commit cf87be70f9

View file

@ -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;
} }