Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi.config - setting defaults as the Ethernet library #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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