Skip to content

Commit

Permalink
WiFi.config - setting defaults as the Ethernet library
Browse files Browse the repository at this point in the history
  • Loading branch information
JAndrassy committed Feb 5, 2022
1 parent 04f088b commit 6bcafe2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,26 @@ uint32_t WiFiClass::provisioned()

void WiFiClass::config(IPAddress local_ip)
{
config(local_ip, (uint32_t)0);
// Assume the DNS server will be the machine on the same network as the local IP
// but with last octet being '1'
IPAddress dns = local_ip;
dns[3] = 1;
config(local_ip, dns);
}

void WiFiClass::config(IPAddress local_ip, IPAddress dns_server)
{
config(local_ip, dns_server, (uint32_t)0);
// Assume the gateway will be the machine on the same network as the local IP
// but with last octet being '1'
IPAddress gateway = local_ip;
gateway[3] = 1;
config(local_ip, dns_server, gateway);
}

void WiFiClass::config(IPAddress local_ip, IPAddress dns_server, IPAddress gateway)
{
config(local_ip, dns_server, gateway, (uint32_t)0);
IPAddress subnet(255, 255, 255, 0);
config(local_ip, dns_server, gateway, subnet);
}

void WiFiClass::config(IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
Expand Down

0 comments on commit 6bcafe2

Please sign in to comment.