Skip to content

Commit e44e633

Browse files
committed
WiFi.config - setting defaults as the Ethernet library
1 parent 04f088b commit e44e633

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/WiFi.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -643,16 +643,25 @@ uint32_t WiFiClass::provisioned()
643643

644644
void WiFiClass::config(IPAddress local_ip)
645645
{
646-
config(local_ip, (uint32_t)0);
646+
// Assume the DNS server will be the machine on the same network as the local IP
647+
// but with last octet being '1'
648+
IPAddress dns = local_ip;
649+
dns[3] = 1;
650+
config(local_ip, dns);
647651
}
648652

649653
void WiFiClass::config(IPAddress local_ip, IPAddress dns_server)
650654
{
651-
config(local_ip, dns_server, (uint32_t)0);
655+
// Assume the gateway will be the machine on the same network as the local IP
656+
// but with last octet being '1'
657+
IPAddress gateway = local_ip;
658+
gateway[3] = 1;
659+
config(local_ip, dns_server, gateway);
652660
}
653661

654662
void WiFiClass::config(IPAddress local_ip, IPAddress dns_server, IPAddress gateway)
655663
{
664+
IPAddress subnet(255, 255, 255, 0);
656665
config(local_ip, dns_server, gateway, (uint32_t)0);
657666
}
658667

0 commit comments

Comments
 (0)