diff --git a/doc/esp8266wifi/soft-access-point-class.rst b/doc/esp8266wifi/soft-access-point-class.rst index 6e0a9dd2f..9cf7b1645 100644 --- a/doc/esp8266wifi/soft-access-point-class.rst +++ b/doc/esp8266wifi/soft-access-point-class.rst @@ -50,8 +50,8 @@ The first parameter of this function is required, remaining four are optional. Meaning of all parameters is as follows: -- ``ssid`` - character string containing network SSID (max. 63 characters) -- ``password`` - optional character string with a password. For WPA2-PSK network it should be at least 8 character long. If not specified, the access point will be open for anybody to connect. +- ``ssid`` - character string containing network SSID (max. 31 characters) +- ``password`` - optional character string with a password. For WPA2-PSK network it should be at least 8 character long. If not specified, the access point will be open for anybody to connect, (max. 63 characters). - ``channel`` - optional parameter to set Wi-Fi channel, from 1 to 13. Default channel = 1. - ``hidden`` - optional parameter, if set to ``true`` will hide SSID. - ``max_connection`` - optional parameter to set max simultaneous connected stations, `from 0 to 8 `__. Defaults to 4. Once the max number has been reached, any other station that wants to connect will be forced to wait until an already connected station disconnects. diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp index 24843d6d3..9d1ba5ea0 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp @@ -85,8 +85,8 @@ static bool softap_config_equal(const softap_config& lhs, const softap_config& r /** * Set up an access point - * @param ssid Pointer to the SSID (max 63 char). - * @param passphrase (for WPA2 min 8 char, for open use NULL) + * @param ssid Pointer to the SSID (max 31 char). + * @param passphrase For WPA2 min 8 char, for open use NULL (max 63 char). * @param channel WiFi channel number, 1 - 13. * @param ssid_hidden Network cloaking (0 = broadcast SSID, 1 = hide SSID) * @param max_connection Max simultaneous connected clients, 0 - 8. https://bbs.espressif.com/viewtopic.php?f=46&t=481&p=1832&hilit=max_connection#p1832 @@ -345,14 +345,14 @@ String ESP8266WiFiAPClass::softAPmacAddress(void) { * @return String SSID. */ String ESP8266WiFiAPClass::softAPSSID() const { - struct softap_config config; - wifi_softap_get_config(&config); - char* name = reinterpret_cast(config.ssid); - char ssid[sizeof(config.ssid) + 1]; - memcpy(ssid, name, sizeof(config.ssid)); - ssid[sizeof(config.ssid)] = '\0'; - - return String(ssid); + struct softap_config config; + wifi_softap_get_config(&config); + char* name = reinterpret_cast(config.ssid); + char ssid[sizeof(config.ssid) + 1]; + memcpy(ssid, name, sizeof(config.ssid)); + ssid[sizeof(config.ssid)] = '\0'; + + return String(ssid); } /** @@ -360,12 +360,12 @@ String ESP8266WiFiAPClass::softAPSSID() const { * @return String psk. */ String ESP8266WiFiAPClass::softAPPSK() const { - struct softap_config config; - wifi_softap_get_config(&config); - char* pass = reinterpret_cast(config.password); - char psk[sizeof(config.password) + 1]; - memcpy(psk, pass, sizeof(config.password)); - psk[sizeof(config.password)] = '\0'; - - return String(psk); + struct softap_config config; + wifi_softap_get_config(&config); + char* pass = reinterpret_cast(config.password); + char psk[sizeof(config.password) + 1]; + memcpy(psk, pass, sizeof(config.password)); + psk[sizeof(config.password)] = '\0'; + + return String(psk); } diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp index 1582124a3..631aa381d 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp @@ -523,7 +523,7 @@ static bool _dns_lookup_pending = false; * @param aHostname Name to be resolved * @param aResult IPAddress structure to store the returned IP address * @return 1 if aIPAddrString was successfully converted to an IP address, - * else error code + * else 0 */ int ESP8266WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult) {