Skip to content

Commit 9a6d62a

Browse files
committed
Use local IP set by config in beginAP if provided
1 parent a2aa01d commit 9a6d62a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/WiFi.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,14 @@ uint8_t WiFiClass::startAP(const char *ssid, uint8_t u8SecType, const void *pvAu
400400
strcpy((char *)&strM2MAPConfig.au8SSID, ssid);
401401
strM2MAPConfig.u8ListenChannel = channel - 1;
402402
strM2MAPConfig.u8SecType = u8SecType;
403-
strM2MAPConfig.au8DHCPServerIP[0] = 0xC0; /* 192 */
404-
strM2MAPConfig.au8DHCPServerIP[1] = 0xA8; /* 168 */
405-
strM2MAPConfig.au8DHCPServerIP[2] = 0x01; /* 1 */
406-
strM2MAPConfig.au8DHCPServerIP[3] = 0x01; /* 1 */
403+
if (_localip == 0) {
404+
strM2MAPConfig.au8DHCPServerIP[0] = 192;
405+
strM2MAPConfig.au8DHCPServerIP[1] = 168;
406+
strM2MAPConfig.au8DHCPServerIP[2] = 1;
407+
strM2MAPConfig.au8DHCPServerIP[3] = 1;
408+
} else {
409+
memcpy(strM2MAPConfig.au8DHCPServerIP, &_localip, sizeof(_localip));
410+
}
407411

408412
if (u8SecType == M2M_WIFI_SEC_WEP) {
409413
tstrM2mWifiWepParams* wep_params = (tstrM2mWifiWepParams*)pvAuthInfo;

0 commit comments

Comments
 (0)