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 Jan 15, 2022
1 parent 04f088b commit e44e633
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,16 +643,25 @@ 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)
{
IPAddress subnet(255, 255, 255, 0);
config(local_ip, dns_server, gateway, (uint32_t)0);
}

Expand Down

0 comments on commit e44e633

Please sign in to comment.