Skip to content

Commit 45c85f3

Browse files
adapting cherry pick
1 parent 58f9561 commit 45c85f3

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

libraries/WiFi/src/WiFi.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,8 @@ extern uint8_t *IpAddress2uint8(IPAddress a);
8080

8181
/* -------------------------------------------------------------------------- */
8282
void CWifi::_config(IPAddress local_ip, IPAddress gateway, IPAddress subnet) {
83-
/* -------------------------------------------------------------------------- */
84-
_useStaticIp = local_ip != INADDR_NONE;
85-
if(ni != nullptr) {
86-
ni->config(local_ip, gateway, subnet);
87-
}
88-
else {
89-
CNetIf::default_ip = local_ip;
90-
CNetIf::default_nm = subnet;
91-
CNetIf::default_gw = gateway;
92-
CNetIf::default_dhcp_server_ip = local_ip;
93-
}
83+
/* -------------------------------------------------------------------------- */
84+
CWifiStation.config(local_ip, gateway, subnet)
9485
}
9586

9687
/* -------------------------------------------------------------------------- */

libraries/lwIpWrapper/src/CNetIf.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -964,12 +964,12 @@ err_t CWifiSoftAp::output(struct netif* _ni, struct pbuf* p) {
964964
/* -------------------------------------------------------------------------- */
965965
void CNetIf::config(IPAddress _ip, IPAddress _gw, IPAddress _nm)
966966
{
967-
DhcpStop();
968-
DhcpNotUsed();
967+
dhcpStop();
968+
dhcpStart();
969969

970-
IP_ADDR4(&ip, _ip[0], _ip[1], _ip[2], _ip[3]);
971-
IP_ADDR4(&nm, _nm[0], _nm[1], _nm[2], _nm[3]);
972-
IP_ADDR4(&gw, _gw[0], _gw[1], _gw[2], _gw[3]);
970+
ip_addr_t ip = fromArduinoIP(_ip);
971+
ip_addr_t nm = fromArduinoIP(_gw);
972+
ip_addr_t gw = fromArduinoIP(_nm);
973973

974974
netif_set_addr(&ni, &ip, &nm, &gw);
975975

0 commit comments

Comments
 (0)