-->
Page 1 of 6

Does not run init.lua at boot

PostPosted: Sat Apr 04, 2015 9:53 am
by VikingGuy
It says "cannot open init.lua" when the ESP8266 boots.

I have to manually load my script each time (using Esplorer Ver 2.0)

More info:
NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4

Re: Does not run init.lua at boot

PostPosted: Sat Apr 04, 2015 4:13 pm
by TerryE
Your post doesn't really enough context to allow us to help. When you upload your script to the ESP8266, are you saving it as init.lua? If you haven't created an init.lua file then the lua bootstrap can't load it.

Also when you are testing it's worth keeping the init.lua small and bomb proof. Otherwise you will discover to your cost that you can get stuck in a reboot crash loop. One technique to avoid this is to hang your main code off a 10s one-shot timer alarm. When debugging this gives you 10s to delete the local copy of init.lua and avoid having to reflash the system.

Re: Does not run init.lua at boot

PostPosted: Sun Apr 05, 2015 9:42 am
by VikingGuy
Using ESPLorer V2.0
I click on the Upload button to upload init.lua
The load appears to load ok until the end of loading. It states that 'timeout reached. Command aborted'

I don't know if this is stating that there is a loading issue or if it something with the ESPLorer application, because the loading progress bar goes up to 100%.

I know that the ESP has not crashed, as I can send commands to it.

Text of loading:

> Uploading to ESP file init.lua...Waiting answer from ESP - Timeout reached. Command aborted

NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4
lua: cannot open init.lua
>


I've even tried uploading a one line init.lua file:
print(wifi.sta.getip())

The only way that I can get the ESP to run the intended script (init.lua)
is to send it manually. By this I mean that I select all and right click on the open init.lua file within ESPLorer
and select 'Send selected to ESP'

Is there a way that I can look into the ESP to see the contents of its init.lau file are? (this will verify that it has loaded correctly.

Is there any other way to verify that the init.lua file has loaded correctly?

Many thanks!

Re: Does not run init.lua at boot

PostPosted: Sun Apr 05, 2015 10:02 am
by VikingGuy
Using a different program to upload: LauUploader V 1.0.2.4

I can see in the 'output window ' it appears that we are not opening the init.lua file: (it states 'open a file first')

how is this, when we ask to open the file?

file.remove("init.lua")
> file.open("init.lua","w")
> file.writeline('wifi.setmode(wifi.STATION)')
stdin:1: open a file first



Many thanks.