-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.lua
31 lines (28 loc) · 805 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
--from https://bigdanzblog.wordpress.com/2015/04/24/esp8266-nodemcu-interrupting-init-lua-during-boot/
function abortInit()
-- initailize abort boolean flag
abort = false
print('Press ENTER to abort startup')
-- if <CR> is pressed, call abortTest
uart.on('data', '\r', abortTest, 0)
-- start timer to execute startup function in 5 seconds
tmr.alarm(0,5000,0,startup)
end
function abortTest(data)
-- user requested abort
abort = true
-- turns off uart scanning
uart.on('data')
end
function startup()
uart.on('data')
-- if user requested abort, exit
if abort == true then
print('startup aborted')
return
end
-- otherwise, start up
print('in startup')
require('run')
end
tmr.alarm(0,1000,0,abortInit)