fix DHCP setting ignored

This commit is contained in:
technyon
2024-08-16 13:21:51 +02:00
parent 9a896a7ab1
commit ab9997a080
2 changed files with 10 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
#define NUKI_HUB_VERSION "9.01" #define NUKI_HUB_VERSION "9.01"
#define NUKI_HUB_BUILD "unknownbuildnr" #define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "unknownbuilddate" #define NUKI_HUB_DATE "2024-08-16"
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest" #define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json" #define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"

View File

@@ -131,6 +131,7 @@ void EthernetDevice::initialize()
if(_hardwareInitialized) if(_hardwareInitialized)
{ {
Log->println(F("Ethernet hardware Initialized")); Log->println(F("Ethernet hardware Initialized"));
ETH.config(_ipConfiguration->ipAddress(), _ipConfiguration->defaultGateway(), _ipConfiguration->subnet(), _ipConfiguration->dnsServer());
Network.onEvent([&](arduino_event_id_t event, arduino_event_info_t info) Network.onEvent([&](arduino_event_id_t event, arduino_event_info_t info)
{ {
@@ -138,7 +139,10 @@ void EthernetDevice::initialize()
case ARDUINO_EVENT_ETH_START: case ARDUINO_EVENT_ETH_START:
Log->println("ETH Started"); Log->println("ETH Started");
ETH.setHostname(_hostname.c_str()); ETH.setHostname(_hostname.c_str());
if(!_ipConfiguration->dhcpEnabled()) ETH.config(_ipConfiguration->ipAddress(), _ipConfiguration->defaultGateway(), _ipConfiguration->subnet(), _ipConfiguration->dnsServer()); if(!_ipConfiguration->dhcpEnabled())
{
ETH.config(_ipConfiguration->ipAddress(), _ipConfiguration->defaultGateway(), _ipConfiguration->subnet(), _ipConfiguration->dnsServer());
}
break; break;
case ARDUINO_EVENT_ETH_CONNECTED: case ARDUINO_EVENT_ETH_CONNECTED:
Log->println("ETH Connected"); Log->println("ETH Connected");
@@ -170,7 +174,10 @@ void EthernetDevice::initialize()
} }
}); });
} }
else Log->println(F("Failed to initialize ethernet hardware")); else
{
Log->println(F("Failed to initialize ethernet hardware"));
}
} }
void EthernetDevice::reconfigure() void EthernetDevice::reconfigure()