Browse Source

fix #1049 static IP

pull/1093/head
lumapu 1 year ago
parent
commit
b67176cbf9
  1. 10
      src/eth/ahoyeth.cpp

10
src/eth/ahoyeth.cpp

@ -32,7 +32,17 @@ void ahoyeth::setup(settings_t *config, uint32_t *utcTimestamp, OnNetworkCB onNe
DPRINTLN(DBG_INFO, F("[ETH]: begin..."));
Serial.flush();
if(mConfig->sys.ip.ip[0] != 0) {
IPAddress ip(mConfig->sys.ip.ip);
IPAddress mask(mConfig->sys.ip.mask);
IPAddress dns1(mConfig->sys.ip.dns1);
IPAddress dns2(mConfig->sys.ip.dns2);
IPAddress gateway(mConfig->sys.ip.gateway);
if(!ETH.config(ip, gateway, mask, dns1, dns2))
DPRINTLN(DBG_ERROR, F("failed to set static IP!"));
}
ETH.begin(ETH_MISO_GPIO, ETH_MOSI_GPIO, ETH_SCK_GPIO, ETH_CS_PIN, ETH_INT_GPIO, ETH_SPI_CLOCK_MHZ, ETH_SPI_HOST);
}

Loading…
Cancel
Save