mode-button-event: use $LogPrintExit

This commit is contained in:
Christian Hesse 2020-04-03 17:32:19 +02:00
parent 413287586f
commit 289fd215c4

View file

@ -7,15 +7,17 @@
:global ModeButton;
:global LogPrintExit;
:set ($ModeButton->"count") ($ModeButton->"count" + 1);
:local Scheduler [ / system scheduler find where name="mode-button-scheduler" ];
:if ([ :len $Scheduler ] = 0) do={
:log info "Creating mode-button scheduler, counting presses...";
$LogPrintExit info ("Creating mode-button scheduler, counting presses...") false;
/ system scheduler add name="mode-button-scheduler" \
on-event="/ system script run mode-button-scheduler;" interval=3s;
} else={
:log debug "Updating mode-button-scheduler...";
$LogPrintExit debug ("Updating mode-button-scheduler...") false;
/ system scheduler set $Scheduler start-time=[ /system clock get time ];
}