Browse Source

optimization, but too less

Program:   33646 bytes (102.7% Full)
IAQ2000+DHT11
agr 4 years ago
parent
commit
0dac7594dc
1 changed files with 15 additions and 14 deletions
  1. +15
    -14
      Web_Net_Setup.ino

+ 15
- 14
Web_Net_Setup.ino View File

@@ -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) = "<html><head><title>Web_i4a_Arduino_Page</title></head><body>\n"
P(Page_end) = "</body></html>";

P(Http400) = "HTTP 400 - BAD REQUEST";
P(Index) = "<h1>index.html</h1><br>This is your main site!<br><a href=\"setupNet.html\">NETWORK SETUP</a><br><a href=\"sensor.html\">Sensor Daten</a>";
P(Index) = "<h1>index.html</h1><br>www.inet4all.at<br><a href=\"setupNet.html\">NETWORK SETUP</a><br><a href=\"sensor.html\">Sensor Daten</a>";

P(Form_eth_start) = "<FORM action=\"setupNet.html\" method=\"get\">";
P(Form_end) = "<FORM>";
@@ -371,11 +372,11 @@ P(IP) = "IP : ";
P(SUBNET) = "Subnet: ";
P(GW) = "GW : ";
P(DNS_SERVER) = "DNS : ";
P(WEB_PORT) = "Webserver port (1-65535): ";
P(WEB_PORT) = "Web port: ";
P(DHCP_ACTIVE) = "Use DHCP: ";
P(DHCP_REFRESH) = "Renew interval for DHCP in minutes (1 - 255): ";
P(MQTT_SERVER) = "MQTT server: ";
P(MQTT_PORT) = "MQTTserver port (1-65535): ";
P(DHCP_REFRESH) = "Renew in min: ";
P(MQTT_SERVER) = "MQTT ip: ";
P(MQTT_PORT) = "MQTT port: ";

P(Form_cb) = "<input type=\"radio\" name=\"23\" value=\"";
P(Form_cb_checked) = " checked ";
@@ -391,10 +392,10 @@ P(table_td_start) = "<td>";
P(table_td_end) = "</td>";
P(table_end) = "</table>";

P(Config_set) = "<font size=\"6\" color=\"red\">New configuration stored! <br>Please use the reset button!</font><br>";
P(Config_set) = "<font size=\"6\" color=\"red\">Config stored! <br>restart!</font><br>";

P(DHCP_STATE_TIME) = "DHCP last renew timestamp (sec)";
P(DHCP_STATE) = "DHCP renew return code (sec)";
P(DHCP_STATE_TIME) = "DHCP last renew (sec)";
P(DHCP_STATE) = "DHCP renew return code";

P(UPTIME) = "Uptime: ";



Loading…
Cancel
Save