diff --git a/OpenMQTTGateway.ino b/OpenMQTTGateway.ino index 78e0790..d13861a 100644 --- a/OpenMQTTGateway.ino +++ b/OpenMQTTGateway.ino @@ -527,8 +527,14 @@ void setup_wifimanager(){ #else // Arduino case void setup_ethernet() { - Ethernet.begin(mac, ip); //Comment and uncomment the following line if you want to use advanced network config - //Ethernet.begin(mac, ip, Dns, gateway, subnet); + if (gateway[0] != 0 || Dns[0]!=0) + { + trc(F("Advanced ethernet config")); + Ethernet.begin(mac, ip, Dns, gateway, subnet); + }else{ + trc(F("Simple ethernet config")); + Ethernet.begin(mac, ip); + } trc(F("OpenMQTTGateway ip: ")); Serial.println(Ethernet.localIP()); trc(F("Ethernet ok")); diff --git a/User_config.h b/User_config.h index 3f4b5b6..89581ef 100644 --- a/User_config.h +++ b/User_config.h @@ -68,9 +68,8 @@ char mqtt_port[6] = "1883"; #endif const byte ip[] = { 192, 168, 1, 99 }; //ip adress -// Advanced network config (optional) if you want to use these parameters uncomment line 158, 172 and comment line 171 of OpenMQTTGateway.ino -const byte gateway[] = { 192, 168, 1, 1 }; //ip adress -const byte Dns[] = { 192, 168, 1, 1 }; //ip adress +const byte gateway[] = { 0, 0, 0, 0 }; //ip adress, if first value is different from 0 advanced config network will be used and you should fill gateway & dns +const byte Dns[] = { 0, 0, 0, 0 }; //ip adress, if first value is different from 0 advanced config network will be used and you should fill gateway & dns const byte subnet[] = { 255, 255, 255, 0 }; //ip adress /*-------------DEFINE YOUR OTA PARAMETERS BELOW----------------*/