De-duplicate wifi.sta.getip() call
Technically, if the wifi.sta.getip() or wifi.ap.getip() call return invalid ip addresses, you shouldn't assume that it's running. However, the lack of that type of check means that this change will function similarly without incurring another function call in a constrained stack/heap environment.
This commit is contained in:
parent
7a1a60f383
commit
925af34b1a
@ -79,8 +79,9 @@ return function (port)
|
|||||||
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
local ip = nil
|
-- false and nil evaluate as false
|
||||||
if wifi.sta.getip() then ip = wifi.sta.getip() else ip = wifi.ap.getip() end
|
local ip = wifi.sta.getip()
|
||||||
|
if not ip then ip = wifi.ap.getip() end
|
||||||
print("nodemcu-httpserver running at http://" .. ip .. ":" .. port)
|
print("nodemcu-httpserver running at http://" .. ip .. ":" .. port)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user