Set AP IP address on ::beginAP
The Arduino WiFi normalization ended up calling the underlying LWIP ::config after the AP was begin, resulting in a failure to set the IP configuration of the AP. Move the _wifi.begin() call to after the IP configuration is set. Fixes #1989
This commit is contained in:
parent
042555206b
commit
afbba68549
1 changed files with 4 additions and 4 deletions
|
|
@ -142,10 +142,6 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
|
||||||
_wifi.setTimeout(_timeout);
|
_wifi.setTimeout(_timeout);
|
||||||
_wifi.setAP();
|
_wifi.setAP();
|
||||||
_apMode = true;
|
_apMode = true;
|
||||||
if (!_wifi.begin()) {
|
|
||||||
return WL_IDLE_STATUS;
|
|
||||||
}
|
|
||||||
noLowPowerMode();
|
|
||||||
IPAddress gw = _wifi.gatewayIP();
|
IPAddress gw = _wifi.gatewayIP();
|
||||||
if (!gw.isSet()) {
|
if (!gw.isSet()) {
|
||||||
gw = IPAddress(192, 168, 42, 1);
|
gw = IPAddress(192, 168, 42, 1);
|
||||||
|
|
@ -155,6 +151,10 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
|
||||||
mask = IPAddress(255, 255, 255, 0);
|
mask = IPAddress(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
config(gw);
|
config(gw);
|
||||||
|
if (!_wifi.begin()) {
|
||||||
|
return WL_IDLE_STATUS;
|
||||||
|
}
|
||||||
|
noLowPowerMode();
|
||||||
_dhcpServer = (dhcp_server_t *)malloc(sizeof(dhcp_server_t));
|
_dhcpServer = (dhcp_server_t *)malloc(sizeof(dhcp_server_t));
|
||||||
if (!_dhcpServer) {
|
if (!_dhcpServer) {
|
||||||
// OOM
|
// OOM
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue