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

Expose optional DHCP timeout parameters to Ethernet::begin() #3815

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/Ethernet/src/Ethernet.cpp
Expand Up @@ -8,7 +8,7 @@ uint8_t EthernetClass::_state[MAX_SOCK_NUM] = {
uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = {
0, 0, 0, 0 };

int EthernetClass::begin(uint8_t *mac_address)
int EthernetClass::begin(uint8_t *mac_address, unsigned long timeout, unsigned long responseTimeout)
{
static DhcpClass s_dhcp;
_dhcp = &s_dhcp;
Expand All @@ -22,7 +22,7 @@ int EthernetClass::begin(uint8_t *mac_address)
SPI.endTransaction();

// Now try to get our config info from a DHCP server
int ret = _dhcp->beginWithDHCP(mac_address);
int ret = _dhcp->beginWithDHCP(mac_address, timeout, responseTimeout);
if(ret == 1)
{
// We've successfully found a DHCP server and got our configuration info, so set things
Expand Down
2 changes: 1 addition & 1 deletion libraries/Ethernet/src/Ethernet.h
Expand Up @@ -20,7 +20,7 @@ class EthernetClass {
// Initialise the Ethernet shield to use the provided MAC address and gain the rest of the
// configuration through DHCP.
// Returns 0 if the DHCP configuration failed, and 1 if it succeeded
int begin(uint8_t *mac_address);
int begin(uint8_t *mac_address, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
void begin(uint8_t *mac_address, IPAddress local_ip);
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server);
void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
Expand Down