- Sun May 31, 2015 10:33 am
#19044
Eyal wrote:How does wifi.sta.autoconnect() work? If I set it, will it be saved for the next wakeup? When should I set it?
What this does to complete any connection as part of the first
net.createServer(). It doesn't materially speed up the first connection.
Eyal wrote:I want to use static IP to speed up my application. I used wifi.sta.setip() and it works, but it does not get saved and if I do not call it then on the next wakeup DHCP is used.
Using static IP doesn't really speed up anything apart from the initial DHCP negotiation which only takes a second or so on first boot. There are valid reasons to use static IP, but this isn't really one of them
Eyal wrote:In short, what is the correct way to use a static IP? At what stage of my application should I call the above two (if both are necessary at all)? What information is saved (if any) and what I should redo after a restart?
You have to do it during the
init.luasequence on every boot. The easiest way is to write your config info to a short device-specific
config.lua file and simply
dofile("config.lua") during the inital boot sequences. This can also set a
CONFIG global variable containing any other device-specific parameters, if you wish.
Please see my
Developer FAQ for Q&A on nodeMCU Lua before asking a question here that's already been answered. This and the other official documentation should be your first reference for developing Lua Apps