ESP8266 Developer Zone The Official ESP8266 Forum 2015-09-21T17:38:00+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1101 2015-09-21T17:38:00+08:00 2015-09-21T17:38:00+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1101&p=3785#p3785 <![CDATA[Re: Please make wifi_softap_set_config() usable in every mode]]>
Making both functions callable in every mode would lead to cleaner code.

Statistics: Posted by blubb — Mon Sep 21, 2015 5:38 pm


]]>
2015-09-13T22:50:05+08:00 2015-09-13T22:50:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1101&p=3680#p3680 <![CDATA[Please make wifi_softap_set_config() usable in every mode]]>
Here is why:

Imagine a firmware which lets the user change the access point name (for example along with the host name). When in stationap mode this is no problem, wifi_softap_set_config() stores the new name in flash and returns true. Now, if we're in station-only mode, the new name will not be stored in flash and the function returns false.

So in order to store the new name in flash when in station-only mode we currently have two choices:

1st:
Every time we use wifi_set_opmode(2) or wifi_set_opmode(3) we need to call wifi_softap_set_config() afterwards ensuring the correct name is used.
For this to work we need to store the name in a separate config area, of course. So that it survives a reboot.

or

2nd:
Every time the user sets a new name, we need to call wifi_set_opmode(3) before wifi_softap_set_config() and restore the old mode with another wifi_set_opmode call afterwards. This, of course, will activate the ap for a short period of time even when not desired. I do not know whether there are even other side effects.

From a design perspective both choices are crude! In my opinion this is even is a bug (by design) since it needs workarounds where a clean solution would not.

Statistics: Posted by blubb — Sun Sep 13, 2015 10:50 pm


]]>