Fixed missing SoftAPIP

pull/137/head
Hieromon Ikasamo 5 years ago
parent ba989740fd
commit d2a076249e
  1. 6
      src/AutoConnect.cpp

@ -184,9 +184,7 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long
// Connection unsuccessful, launch the captive portal. // Connection unsuccessful, launch the captive portal.
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
if (!_apConfig.apip && !_apConfig.gateway && !_apConfig.netmask) {
_config(); _config();
}
#endif #endif
WiFi.softAP(_apConfig.apid.c_str(), _apConfig.psk.c_str(), _apConfig.channel, _apConfig.hidden); WiFi.softAP(_apConfig.apid.c_str(), _apConfig.psk.c_str(), _apConfig.channel, _apConfig.hidden);
do { do {
@ -194,9 +192,7 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long
yield(); yield();
} while (!WiFi.softAPIP()); } while (!WiFi.softAPIP());
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
if (!(static_cast<uint32_t>(_apConfig.apip) == 0U || static_cast<uint32_t>(_apConfig.gateway) == 0U || static_cast<uint32_t>(_apConfig.netmask) == 0U)) {
_config(); _config();
}
#endif #endif
if (_apConfig.apip) { if (_apConfig.apip) {
do { do {
@ -300,6 +296,8 @@ bool AutoConnect::config(AutoConnectConfig& Config) {
* by Config method. * by Config method.
*/ */
bool AutoConnect::_config(void) { bool AutoConnect::_config(void) {
if (static_cast<uint32_t>(_apConfig.apip) == 0U || static_cast<uint32_t>(_apConfig.gateway) == 0U || static_cast<uint32_t>(_apConfig.netmask) == 0U)
AC_DBG("Warning: Contains invalid SoftAPIP address(es).\n");
bool rc = WiFi.softAPConfig(_apConfig.apip, _apConfig.gateway, _apConfig.netmask); bool rc = WiFi.softAPConfig(_apConfig.apip, _apConfig.gateway, _apConfig.netmask);
AC_DBG("SoftAP configure %s, %s, %s %s\n", _apConfig.apip.toString().c_str(), _apConfig.gateway.toString().c_str(), _apConfig.netmask.toString().c_str(), rc ? "" : "failed"); AC_DBG("SoftAP configure %s, %s, %s %s\n", _apConfig.apip.toString().c_str(), _apConfig.gateway.toString().c_str(), _apConfig.netmask.toString().c_str(), rc ? "" : "failed");
return rc; return rc;

Loading…
Cancel
Save