summaryrefslogtreecommitdiff
path: root/run.lua
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-01-22 18:37:04 +0100
committerAki <please@ignore.pl>2024-01-22 18:37:04 +0100
commit7b6c20b5c58014861e218e62cf0749bdd0ba727e (patch)
tree56101658210bc39d21631e7f1a90be363807d4d1 /run.lua
parent188b980b2597d39052004cb56277b1684df0007d (diff)
downloadnodemcu-wakeup-7b6c20b5c58014861e218e62cf0749bdd0ba727e.zip
nodemcu-wakeup-7b6c20b5c58014861e218e62cf0749bdd0ba727e.tar.gz
nodemcu-wakeup-7b6c20b5c58014861e218e62cf0749bdd0ba727e.tar.bz2
Use a state machine to perform preparation and wakeups
Diffstat (limited to 'run.lua')
-rw-r--r--run.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/run.lua b/run.lua
index 43f7cad..e5a7627 100644
--- a/run.lua
+++ b/run.lua
@@ -1,6 +1,11 @@
local wakeup = require("wakeup")
return function ()
- wakeup:init()
- tmr.create():alarm(1000, tmr.ALARM_SINGLE, function () wakeup:run() end)
+ tmr.create():alarm(
+ 500,
+ tmr.ALARM_AUTO,
+ function (timer)
+ wakeup:step(timer)
+ collectgarbage()
+ end)
end