Skip to content

Commit d04e751

Browse files
authored
Remove unnecessary MY_IP_RENEWAL_INTERVAL* (#1429)
* Remove unnecessary MY_IP_RENEWAL_INTERVAL* Ethernet.maintain already checks when we need to renew, based on the lease time given by the DHCP server. https://www.arduino.cc/en/Reference/EthernetMaintain recommends "just call it on every loop() invocation" so there is no need for us to keep a separate timer. * Remove call to _w5100_spi_en This function doesn't enable SPI, so it should not disable it either. Let calling functions handle SPI enable/disable.
1 parent 46f243c commit d04e751

File tree

4 files changed

+0
-23
lines changed

4 files changed

+0
-23
lines changed

MyConfig.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,14 +1582,6 @@
15821582
*/
15831583
//#define MY_USE_UDP
15841584

1585-
/**
1586-
* @def MY_IP_RENEWAL_INTERVAL_MS
1587-
* @brief DHCP, default renewal setting in milliseconds.
1588-
*/
1589-
#ifndef MY_IP_RENEWAL_INTERVAL_MS
1590-
#define MY_IP_RENEWAL_INTERVAL_MS (60*1000ul)
1591-
#endif
1592-
15931585
/**
15941586
* @def MY_MAC_ADDRESS
15951587
* @brief Ethernet MAC address.

core/MyGatewayTransportEthernet.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,9 @@ void gatewayTransportRenewIP(void)
150150
3 - rebind failed
151151
4 - rebind success
152152
*/
153-
static uint32_t _nextIPRenewal = hwMillis() + MY_IP_RENEWAL_INTERVAL_MS;
154-
const uint32_t now = hwMillis();
155-
156-
// http://playground.arduino.cc/Code/TimingRollover
157-
if ((int32_t)(now - _nextIPRenewal) < 0) {
158-
return;
159-
}
160153
if (Ethernet.maintain() & ~(0x06)) {
161154
GATEWAY_DEBUG(PSTR("!GWT:TRC:IP RENEW FAIL\n"));
162-
return;
163155
}
164-
_w5100_spi_en(false);
165-
_nextIPRenewal = now + MY_IP_RENEWAL_INTERVAL_MS;
166156
}
167157
#endif
168158

examples/GatewayW5100/GatewayW5100.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@
8484
//#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
8585
//#define MY_IP_SUBNET_ADDRESS 255,255,255,0
8686

87-
// Renewal period if using DHCP
88-
//#define MY_IP_RENEWAL_INTERVAL 60000
89-
9087
// The port to keep open on node server mode / or port to contact in client mode
9188
#define MY_PORT 5003
9289

keywords.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ MY_GATEWAY_MAX_RECEIVE_LENGTH LITERAL1
271271
MY_GATEWAY_MAX_SEND_LENGTH LITERAL1
272272
MY_IP_ADDRESS LITERAL1
273273
MY_IP_GATEWAY_ADDRESS LITERAL1
274-
MY_IP_RENEWAL_INTERVAL LITERAL1
275-
MY_IP_RENEWAL_INTERVAL_MS LITERAL1
276274
MY_IP_SUBNET_ADDRESS LITERAL1
277275
MY_MAC_ADDRESS LITERAL1
278276
MY_PORT LITERAL1

0 commit comments

Comments
 (0)