From ab9997a0805e49fd8df67aeeebbcbc3ca22b3f1b Mon Sep 17 00:00:00 2001 From: technyon Date: Fri, 16 Aug 2024 13:21:51 +0200 Subject: [PATCH] fix DHCP setting ignored --- src/Config.h | 2 +- src/networkDevices/EthernetDevice.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Config.h b/src/Config.h index c6eb3c2..e8586ad 100644 --- a/src/Config.h +++ b/src/Config.h @@ -4,7 +4,7 @@ #define NUKI_HUB_VERSION "9.01" #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_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json" diff --git a/src/networkDevices/EthernetDevice.cpp b/src/networkDevices/EthernetDevice.cpp index 608a13d..19d8e43 100644 --- a/src/networkDevices/EthernetDevice.cpp +++ b/src/networkDevices/EthernetDevice.cpp @@ -131,6 +131,7 @@ void EthernetDevice::initialize() if(_hardwareInitialized) { 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) { @@ -138,7 +139,10 @@ void EthernetDevice::initialize() case ARDUINO_EVENT_ETH_START: Log->println("ETH Started"); 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; case ARDUINO_EVENT_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()