Skip to content

Commit

Permalink
fix #1049 static IP
Browse files Browse the repository at this point in the history
  • Loading branch information
lumapu committed Aug 4, 2023
1 parent 6767792 commit b67176c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/eth/ahoyeth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}


Expand Down Expand Up @@ -240,4 +250,4 @@ void ahoyeth::onEthernetEvent(WiFiEvent_t event, arduino_event_info_t info)

}

#endif /* defined(ETHERNET) */
#endif /* defined(ETHERNET) */

0 comments on commit b67176c

Please sign in to comment.