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
5 changes: 4 additions & 1 deletion libraries/lwIP_Ethernet/src/LwipIntfDev.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class LwipIntfDev: public LwipIntf, public RawDev {
SPIClass& _spiUnit;
SPISettings _spiSettings = SPISettings(4000000, MSBFIRST, SPI_MODE0);
netif _netif;
bool _isDHCP = true;

uint16_t _mtu;
int8_t _intrPin;
Expand Down Expand Up @@ -282,6 +283,8 @@ bool LwipIntfDev<RawDev>::config(const IPAddress& localIP, const IPAddress& gate
return false;
}

_isDHCP = (localIP.v4() == 0);

IPAddress realGateway, realNetmask, realDns1;
if (!ipAddressReorder(localIP, gateway, netmask, dns1, realGateway, realNetmask, realDns1)) {
return false;
Expand Down Expand Up @@ -389,7 +392,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
_phID = __addEthernetPacketHandler([this] { this->handlePackets(); });
}

if (localIP().v4() == 0) {
if (_isDHCP) {
// IP not set, starting DHCP
_netif.flags |= NETIF_FLAG_UP;
switch (dhcp_start(&_netif)) {
Expand Down