allow configuring dhcp

This commit is contained in:
Jonas Leder 2023-01-29 14:33:39 +01:00
commit 4c2020032e
No known key found for this signature in database
GPG key ID: CC3C488E27DFF5CA
2 changed files with 6 additions and 0 deletions

View file

@ -1,5 +1,7 @@
{
"networking": {
"mode": "static",
"comment": "You can also use dhcp here",
"ip": "10.1.0.253",
"netmask": "255.255.255.0",
"gateway": "10.1.0.1"

View file

@ -78,6 +78,10 @@ void setup()
ESP32_W5500_onEvent();
ETH.begin(MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST);
if(configuration["networking"]["mode"] == "static")
{
ETH.config(ipAddress, gatewayAddress, subnetMask, dnsAddress);
}
ETH.config(ipAddress, gatewayAddress, subnetMask, dnsAddress);
server.on(F("/"), handleRoot);