diff --git a/Web_Net_Setup.ino b/Web_Net_Setup.ino index eee2720..b2ab3f2 100644 --- a/Web_Net_Setup.ino +++ b/Web_Net_Setup.ino @@ -65,6 +65,7 @@ //#define WEBDUINO_FAVICON_DATA "" // no favicon //#define DEBUG //uncomment for serial debug output //#define USE_SYSTEM_LIBRARY //comment out if you want to save some space (about 1 Byte). You wouldn't see uptime and free RAM if it's commented out. +//#define SET_DEFAULT // comment out if Arduino is not initialized with EEPROM Default Settings #define SERIAL_BAUD 9600 #include "SPI.h" // new include @@ -108,10 +109,11 @@ unsigned long loopcnt = 0; * The default settings. * This settings are used when no config is present or the reset button is pressed. */ + void set_EEPROM_Default() { eeprom_config.config_set = 1; // dont change! It's used to check if the config is already set - - eeprom_config.use_dhcp = 0; // use DHCP per default +#ifdef SET_DEFAULT + eeprom_config.use_dhcp = 1; // use DHCP per default eeprom_config.dhcp_refresh_minutes = 60; // refresh the DHCP every 60 minutes // set the default MAC address. In this case its DE:AD:BE:EF:FE:ED @@ -157,8 +159,8 @@ void set_EEPROM_Default() { // set the default Webserver Port. In this case its Port 80 eeprom_config.mqttserverPort = 1883; -#ifdef DEBUG - Serial.println("Config reset"); +#else + eeprom_config.use_dhcp = 1; #endif } @@ -182,7 +184,6 @@ void read_EEPROM_Settings() { if (eeprom_config.config_set != 1 || digitalRead(RESET_PIN) == LOW) { // set default values set_EEPROM_Default(); - // write the config to eeprom EEPROM_writeAnything(0, eeprom_config); } @@ -331,7 +332,7 @@ void setupNetwork() { Ethernet.begin(eeprom_config.mac, ip, dns_server, gateway, subnet); } else { if (Ethernet.begin(eeprom_config.mac) == 0) { - Serial.print("Failed to configure Ethernet using DHCP"); + Serial.print("Failed DHCP"); } Serial.println(Ethernet.localIP()); } @@ -354,7 +355,7 @@ P(Page_start) = "