Browse Source

Replaced obsolete static timers in lfs_fragments.lua (nodemcu #2764)

Alistair Witt 5 years ago
parent
commit
bc1dd37aee
1 changed files with 7 additions and 4 deletions
  1. 7 4
      lua_examples/lfs/lfs_fragments.lua

+ 7 - 4
lua_examples/lfs/lfs_fragments.lua

@@ -56,8 +56,11 @@ if node.flashindex() == nil then
   node.flashreload('flash.img')
 end
 
-tmr.alarm(0, 1000, tmr.ALARM_SINGLE,
-  function()
-    local fi=node.flashindex; return pcall(fi and fi'_init')
-  end)
+local initTimer = tmr.create()
+initTimer:register(1000, tmr.ALARM_SINGLE,
+    function()
+        local fi=node.flashindex; return pcall(fi and fi'_init')
+    end
+    )
+initTimer:start()