Setting static IP before connecting? #6250
Replies: 1 comment
-
Posted at 2019-04-12 by @allObjects Reference http://www.espruino.com/Reference#l_Wifi_connect mentions that options will have a way to pass expected ip address to use rather than dhcp... but as said: will - as future enhancement. On the other hand, your access point may have the option to not do dhcp at all or for not for particular MAC addresses and define the repsective ip to use. May be you can control it there. Posted at 2019-04-13 by @MaBecker
No, scan and connect to access point is the time consumer, not DHCP. Using channel and bssid in Wifi.connect() speeds this up to one sec, Posted at 2019-04-13 by Thijsmans @allObjects Thanks for the intel on possible future enhancements ;) I doubt though if setting a static IP on the AP-side will speed up things. It doesn't change the DHCP-negotiation as such, as far as I know, but just returns the same IP all of the time. Thanks @MaBecker, I'll look into it! Unfortunately, my AP automatically jumps channels, depending on other network signals. So using a particular channel won't work. The BSSID sounds promising though (or would this only help in a situation with multiple AP's sharing one SSID?). Posted at 2019-04-13 by @MaBecker The bssid is the kicker, as far as I understand. @thijsmans: If you like I can share my latest build which include this fixes via github , just let me know, so another person can run some test with it - what do you think? Posted at 2019-04-22 by Thijsmans Would love to test, but I can't compile it myself because of a lack of skills ;-) Posted at 2019-04-22 by @MaBecker choose the last travis build it is merged Posted at 2019-04-22 by @MaBecker http://www.espruino.com/binaries/travis/master/ Posted at 2019-04-26 by Thijsmans Benchmarked and... well done MaBe :) A full report can be found @ my Tweakblog, which is dutch but translate pretty accurate using Google. Posted at 2019-04-26 by @MaBecker thanks for testing and posting your results. Posted at 2019-06-21 by maze1980 @thijsmans: Either there was a huge improvement in espruino (2v03), or your WIFI AP and DHCP server are both slow. For me using DHCP the connection is usually up in 2.18 seconds. I tested also with channel and bssid, but this didn't change anything for me. My code:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-04-12 by Thijsmans
So I found this threat where wifi.setIP() was implemented to set a static IP for an ESP8266. These docs mention "You must be connected to an access point to be able to call this successfully". I thought I misinterpreted it, because: why setting a static IP once connected? Turns out the documentation is right: calling wifi.setIP() before connecting to wifi, does nothing. Calling it once connected actually changes the IP-address.
I want to get rid of DHCP in the first place. I'm building a battery-fed deep sleep project. DHCP is terribly slow and takes around 4 seconds (which is 40% of the total time needed for measuring and transmitting the results).
Any thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions