10000 Set AP IP address on ::beginAP · LinusHeu/arduino-pico@afbba68 · GitHub
[go: up one dir, main page]

Skip to content

Commit afbba68

Browse files
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 earlephilhower#1989
1 parent 0425552 commit afbba68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/WiFi/src/WiFiClass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
142142
_wifi.setTimeout(_timeout);
143143
_wifi.setAP();
144144
_apMode = true;
145-
if (!_wifi.begin()) {
146-
return WL_IDLE_STATUS;
147-
}
148-
noLowPowerMode();
149145
IPAddress gw = _wifi.gatewayIP();
150146
if (!gw.isSet()) {
151147
gw = IPAddress(192, 168, 42, 1);
@@ -155,6 +151,10 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
155151
mask = IPAddress(255, 255, 255, 0);
156152
}
157153
config(gw);
154+
if (!_wifi.begin()) {
155+
return WL_IDLE_STATUS;
156+
}
157+
noLowPowerMode();
158158
_dhcpServer = (dhcp_server_t *)malloc(sizeof(dhcp_server_t));
159159
if (!_dhcpServer) {
160160
// OOM

0 commit comments

Comments
 (0)
0