Skip to content
Merged
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
17 changes: 12 additions & 5 deletions src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,26 @@ uint8_t WiFiClass::beginEnterprise(const char* ssid, const char* username, const

void WiFiClass::config(IPAddress local_ip)
{
WiFiDrv::config(1, (uint32_t)local_ip, 0, 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)
{
WiFiDrv::config(1, (uint32_t)local_ip, 0, 0);
WiFiDrv::setDNS(1, (uint32_t)dns_server, 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)
{
WiFiDrv::config(2, (uint32_t)local_ip, (uint32_t)gateway, 0);
WiFiDrv::setDNS(1, (uint32_t)dns_server, 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