-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.lua
44 lines (37 loc) · 850 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- dofile"SSD1306.lua"
dofile"SSD1327-waveshare-128x128.lua"
function run_file(file)
print("Starting",file)
dofile(file)
print_free()
end
function run_prefix(prefix)
local files={}
for key,value in pairs(file.list()) do
if (key:match(prefix.."%d%d.*%.lua")) then
table.insert(files,key)
end
end
table.sort(files)
for i,value in ipairs(files) do
run_file(value)
end
end
function start()
run_prefix("S")
run_file("is.lua")
end
function kill()
run_prefix("K")
end
function print_free()
print(node.heap().." Bytes free, "..(collectgarbage("count")*1024).." in use")
end
print_free()
boottimer = tmr.create()
print("Booting in 5 seconds, enter stop() to cancel")
boottimer:register(5000, tmr.ALARM_SINGLE, start)
boottimer:start()
function stop()
boottimer:stop()
end