mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
Some delay() modifications. DomoticzSend serial command. AnalogRead is broken in IDE?
This commit is contained in:
+13
-11
@@ -8,7 +8,7 @@ boolean Domoticz_getData(int idx, float *data)
|
||||
char host[20];
|
||||
sprintf(host, "%u.%u.%u.%u", Settings.Controller_IP[0], Settings.Controller_IP[1], Settings.Controller_IP[2], Settings.Controller_IP[3]);
|
||||
|
||||
Serial.print("HTTP : Connecting to ");
|
||||
Serial.print(F("HTTP : Connecting to "));
|
||||
Serial.println(host);
|
||||
|
||||
// Use WiFiClient class to create TCP connections
|
||||
@@ -16,7 +16,7 @@ boolean Domoticz_getData(int idx, float *data)
|
||||
if (!client.connect(host, Settings.ControllerPort))
|
||||
{
|
||||
connectionFailures++;
|
||||
Serial.println("HTTP : Connection failed");
|
||||
Serial.println(F("HTTP : Connection failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ boolean Domoticz_getData(int idx, float *data)
|
||||
String url = "/json.htm?type=devices&rid=";
|
||||
url += idx;
|
||||
|
||||
Serial.print("HTTP : Requesting URL: ");
|
||||
Serial.print(F("HTTP : Requesting URL: "));
|
||||
Serial.println(url);
|
||||
|
||||
// This will send the request to the server
|
||||
@@ -33,7 +33,8 @@ boolean Domoticz_getData(int idx, float *data)
|
||||
"Connection: close\r\n\r\n");
|
||||
|
||||
unsigned long timer = millis() + 200;
|
||||
while (!client.available() && millis() < timer) {}
|
||||
while (!client.available() && millis() < timer)
|
||||
delay(1);
|
||||
|
||||
// Read all the lines of the reply from server and print them to Serial
|
||||
|
||||
@@ -51,7 +52,7 @@ boolean Domoticz_getData(int idx, float *data)
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
Serial.println("HTTP : Closing connection");
|
||||
Serial.println(F("HTTP : Closing connection"));
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ boolean Domoticz_sendData(byte sensorType, int idx, byte varIndex)
|
||||
char host[20];
|
||||
sprintf(host, "%u.%u.%u.%u", Settings.Controller_IP[0], Settings.Controller_IP[1], Settings.Controller_IP[2], Settings.Controller_IP[3]);
|
||||
|
||||
Serial.print("HTTP : Connecting to ");
|
||||
Serial.print(F("HTTP : Connecting to "));
|
||||
Serial.println(host);
|
||||
|
||||
// Use WiFiClient class to create TCP connections
|
||||
@@ -69,12 +70,12 @@ boolean Domoticz_sendData(byte sensorType, int idx, byte varIndex)
|
||||
if (!client.connect(host, Settings.ControllerPort))
|
||||
{
|
||||
connectionFailures++;
|
||||
Serial.println("HTTP : Connection failed");
|
||||
Serial.println(F("HTTP : Connection failed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// We now create a URI for the request
|
||||
String url = "/json.htm?type=command¶m=udevice&idx=";
|
||||
String url = F("/json.htm?type=command¶m=udevice&idx=");
|
||||
url += idx;
|
||||
switch(sensorType)
|
||||
{
|
||||
@@ -98,7 +99,7 @@ boolean Domoticz_sendData(byte sensorType, int idx, byte varIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
Serial.print("HTTP : Requesting URL: ");
|
||||
Serial.print(F("HTTP : Requesting URL: "));
|
||||
Serial.println(url);
|
||||
|
||||
// This will send the request to the server
|
||||
@@ -107,7 +108,8 @@ boolean Domoticz_sendData(byte sensorType, int idx, byte varIndex)
|
||||
"Connection: close\r\n\r\n");
|
||||
|
||||
unsigned long timer = millis() + 200;
|
||||
while (!client.available() && millis() < timer) {}
|
||||
while (!client.available() && millis() < timer)
|
||||
delay(1);
|
||||
|
||||
// Read all the lines of the reply from server and print them to Serial
|
||||
while (client.available()) {
|
||||
@@ -118,7 +120,7 @@ boolean Domoticz_sendData(byte sensorType, int idx, byte varIndex)
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
Serial.println("HTTP : Closing connection");
|
||||
Serial.println(F("HTTP : Closing connection"));
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@ void pulseinit(byte Par1)
|
||||
boolean analog(byte Par1)
|
||||
{
|
||||
boolean success = false;
|
||||
int value = analogRead(A0);
|
||||
//int value = analogRead(A0); // crashes on latest release...
|
||||
int value = millis()/1000;
|
||||
UserVar[Par1 - 1] = (float)value;
|
||||
Serial.print("ADC : Analog value: ");
|
||||
Serial.println(value);
|
||||
|
||||
+17
-16
@@ -51,7 +51,7 @@
|
||||
|
||||
#define ESP_PROJECT_PID 2015050101L
|
||||
#define VERSION 1
|
||||
#define BUILD 5
|
||||
#define BUILD 6
|
||||
|
||||
#define UDP_LISTEN_PORT 65500
|
||||
#define REBOOT_ON_MAX_CONNECTION_FAILURES 30
|
||||
@@ -117,7 +117,7 @@ unsigned long pulseCounter1=0;
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(19200);
|
||||
Serial.print("\nINIT : Booting Build nr:");
|
||||
Serial.print(F("\nINIT : Booting Build nr:"));
|
||||
Serial.println(BUILD);
|
||||
|
||||
EEPROM.begin(4096);
|
||||
@@ -129,7 +129,7 @@ void setup()
|
||||
Serial.println(Settings.Version);
|
||||
if (Settings.Version != VERSION || Settings.PID != ESP_PROJECT_PID)
|
||||
{
|
||||
Serial.println("INIT : Incorrect PID or version!");
|
||||
Serial.println(F("INIT : Incorrect PID or version!"));
|
||||
delay(10000);
|
||||
ResetFactory();
|
||||
}
|
||||
@@ -137,31 +137,31 @@ void setup()
|
||||
// configure hardware pins according to eeprom settings.
|
||||
if (Settings.Pin_i2c_sda != -1)
|
||||
{
|
||||
Serial.println("INIT : I2C");
|
||||
Serial.println(F("INIT : I2C"));
|
||||
Wire.begin(Settings.Pin_i2c_sda, Settings.Pin_i2c_scl);
|
||||
}
|
||||
|
||||
if (Settings.Pin_wired_in_1 != -1)
|
||||
{
|
||||
Serial.println("INIT : Input 1");
|
||||
Serial.println(F("INIT : Input 1"));
|
||||
pinMode(Settings.Pin_wired_in_1, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
if (Settings.Pin_wired_in_2 != -1)
|
||||
{
|
||||
Serial.println("INIT : Input 2");
|
||||
Serial.println(F("INIT : Input 2"));
|
||||
pinMode(Settings.Pin_wired_in_2, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
if (Settings.Pin_wired_out_1 != -1)
|
||||
{
|
||||
Serial.println("INIT : Output 1");
|
||||
Serial.println(F("INIT : Output 1"));
|
||||
pinMode(Settings.Pin_wired_out_1, OUTPUT);
|
||||
}
|
||||
|
||||
if (Settings.Pin_wired_out_2 != -1)
|
||||
{
|
||||
Serial.println("INIT : Output 2");
|
||||
Serial.println(F("INIT : Output 2"));
|
||||
pinMode(Settings.Pin_wired_out_2, OUTPUT);
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ void setup()
|
||||
IPAddress ip = WiFi.localIP();
|
||||
if (ip[0]==0) // dhcp issue ?
|
||||
{
|
||||
Serial.println("No IP!");
|
||||
Serial.println(F("No IP!"));
|
||||
delayedReboot(60);
|
||||
}
|
||||
}
|
||||
@@ -214,13 +214,12 @@ void setup()
|
||||
WifiAPMode(true);
|
||||
}
|
||||
|
||||
Serial.println("INIT : Boot OK");
|
||||
Serial.println(F("INIT : Boot OK"));
|
||||
syslog((char*)"Boot");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
yield();
|
||||
server.handleClient();
|
||||
|
||||
if (Serial.available())
|
||||
@@ -279,9 +278,11 @@ void loop()
|
||||
|
||||
if(connectionFailures > REBOOT_ON_MAX_CONNECTION_FAILURES)
|
||||
{
|
||||
Serial.println("Too many connection failures");
|
||||
Serial.println(F("Too many connection failures"));
|
||||
delayedReboot(60);
|
||||
}
|
||||
|
||||
delay(10);
|
||||
}
|
||||
|
||||
void inputCheck()
|
||||
@@ -336,13 +337,13 @@ void SensorSend()
|
||||
float value=0;
|
||||
if (Domoticz_getData(Settings.Pulse1, &value))
|
||||
{
|
||||
Serial.print("Current Value:");
|
||||
Serial.print(F("Current Value:"));
|
||||
Serial.println(value);
|
||||
Serial.print("Delta Value:");
|
||||
Serial.print(F("Delta Value:"));
|
||||
Serial.println(pulseCounter1);
|
||||
value=(value + pulseCounter1)*100;
|
||||
pulseCounter1=0;
|
||||
Serial.print("New Value:");
|
||||
Serial.print(F("New Value:"));
|
||||
Serial.println(value);
|
||||
UserVar[9 - 1] = value; // store pulsecount to var 9
|
||||
Domoticz_sendData(1, Settings.Pulse1, 9);
|
||||
@@ -371,7 +372,7 @@ void delayedReboot(int rebootDelay)
|
||||
{
|
||||
while (rebootDelay !=0 )
|
||||
{
|
||||
Serial.print("Delayed Reset ");
|
||||
Serial.print(F("Delayed Reset "));
|
||||
Serial.println(rebootDelay);
|
||||
rebootDelay--;
|
||||
delay(1000);
|
||||
|
||||
+10
-1
@@ -11,7 +11,7 @@ void ExecuteCommand(char *Line)
|
||||
Command[0] = 0;
|
||||
int Par1 = 0;
|
||||
int Par2 = 0;
|
||||
|
||||
|
||||
GetArgv(Line, Command, 1);
|
||||
if (GetArgv(Line, TmpStr1, 2)) Par1 = str2int(TmpStr1);
|
||||
if (GetArgv(Line, TmpStr1, 3)) Par2 = str2int(TmpStr1);
|
||||
@@ -20,6 +20,15 @@ void ExecuteCommand(char *Line)
|
||||
// commands to execute io tasks
|
||||
// ****************************************
|
||||
|
||||
if (strcasecmp(Command, "DomoticzSend") == 0)
|
||||
{
|
||||
if (GetArgv(Line, TmpStr1, 4))
|
||||
{
|
||||
UserVar[10 - 1] = atof(TmpStr1);
|
||||
Domoticz_sendData(Par1, Par2, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcasecmp(Command, "UDP") == 0)
|
||||
{
|
||||
if (GetArgv(Line, TmpStr1, 2))
|
||||
|
||||
+65
-65
@@ -2,7 +2,7 @@
|
||||
// Web Interface root page
|
||||
//********************************************************************************
|
||||
void handle_root() {
|
||||
Serial.print("HTTP : Webrequest : ");
|
||||
Serial.print(F("HTTP : Webrequest : "));
|
||||
String webrequest = server.arg("cmd");
|
||||
webrequest.replace("%20", " ");
|
||||
Serial.println(webrequest);
|
||||
@@ -13,15 +13,15 @@ void handle_root() {
|
||||
if (strcasecmp(command, "wifidisconnect") != 0)
|
||||
{
|
||||
ExecuteCommand(command);
|
||||
String reply = "<body><form>Welcome to ESP Easy";
|
||||
reply += "<BR><a href='/config'>Config</a>";
|
||||
reply += "<BR><a href='/devices'>Devices</a>";
|
||||
reply += "<BR><a href='/hardware'>Hardware</a>";
|
||||
reply += "<BR><a href='/?cmd=reboot'>Reboot</a>";
|
||||
reply += "<BR><a href='/?cmd=wifidisconnect'>Disconnect</a>";
|
||||
reply += "<BR><a href='/?cmd=wificonnect'>Connect</a>";
|
||||
String reply = F("<body><form>Welcome to ESP Easy");
|
||||
reply += F("<BR><a href='/config'>Config</a>");
|
||||
reply += F("<BR><a href='/devices'>Devices</a>");
|
||||
reply += F("<BR><a href='/hardware'>Hardware</a>");
|
||||
reply += F("<BR><a href='/?cmd=reboot'>Reboot</a>");
|
||||
reply += F("<BR><a href='/?cmd=wifidisconnect'>Disconnect</a>");
|
||||
reply += F("<BR><a href='/?cmd=wificonnect'>Connect</a>");
|
||||
|
||||
reply += "<BR><BR>System Info";
|
||||
reply += F("<BR><BR>System Info");
|
||||
|
||||
IPAddress ip = WiFi.localIP();
|
||||
IPAddress gw = WiFi.gatewayIP();
|
||||
@@ -32,16 +32,16 @@ void handle_root() {
|
||||
reply += str;
|
||||
|
||||
sprintf(str, "%u.%u.%u.%u", gw[0], gw[1], gw[2], gw[3]);
|
||||
reply += "<BR>GW : ";
|
||||
reply += F("<BR>GW : ");
|
||||
reply += str;
|
||||
|
||||
reply += "<BR>Build : ";
|
||||
reply += F("<BR>Build : ");
|
||||
reply += BUILD;
|
||||
|
||||
reply += "<BR>Unit : ";
|
||||
reply += F("<BR>Unit : ");
|
||||
reply += Settings.Unit;
|
||||
|
||||
reply += "</form></body>";
|
||||
reply += F("</form></body>");
|
||||
server.send(200, "text/html", reply);
|
||||
delay(100);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ void handle_root() {
|
||||
// have to disconnect from within the main loop
|
||||
// because the webconnection is still active at this point
|
||||
// disconnect would result into a crash/reboot...
|
||||
Serial.println("WIFI : Disconnecting...");
|
||||
Serial.println(F("WIFI : Disconnecting..."));
|
||||
cmd_disconnect = true;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ void handle_root() {
|
||||
void handle_config() {
|
||||
char tmpstring[26];
|
||||
|
||||
Serial.println("HTTP : Webconfig : ");
|
||||
Serial.println(F("HTTP : Webconfig : "));
|
||||
|
||||
String ssid = server.arg("ssid");
|
||||
String key = server.arg("key");
|
||||
@@ -91,35 +91,35 @@ void handle_config() {
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
String reply = "<body>";
|
||||
reply += "<form>SSID:<BR><input type='text' name='ssid' value='";
|
||||
String reply = F("<body>");
|
||||
reply += F("<form>SSID:<BR><input type='text' name='ssid' value='");
|
||||
reply += Settings.WifiSSID;
|
||||
reply += "'><BR>WPA Key:<BR><input type='text' name='key' value='";
|
||||
reply += F("'><BR>WPA Key:<BR><input type='text' name='key' value='");
|
||||
reply += Settings.WifiKey;
|
||||
|
||||
reply += "'><BR>Controller IP:<BR><input type='text' name='controllerip' value='";
|
||||
reply += F("'><BR>Controller IP:<BR><input type='text' name='controllerip' value='");
|
||||
char str[20];
|
||||
sprintf(str, "%u.%u.%u.%u", Settings.Controller_IP[0], Settings.Controller_IP[1], Settings.Controller_IP[2], Settings.Controller_IP[3]);
|
||||
reply += str;
|
||||
|
||||
reply += "'><BR>Controller Port:<BR><input type='text' name='controllerport' value='";
|
||||
reply += F("'><BR>Controller Port:<BR><input type='text' name='controllerport' value='");
|
||||
reply += Settings.ControllerPort;
|
||||
reply += "'><BR>Fixed IP Octet: (Optional)<BR><input type='text' name='ip' value='";
|
||||
reply += F("'><BR>Fixed IP Octet: (Optional)<BR><input type='text' name='ip' value='");
|
||||
reply += Settings.IP_Octet;
|
||||
|
||||
reply += "'><BR>Unit nr:<BR><input type='text' name='unit' value='";
|
||||
reply += F("'><BR>Unit nr:<BR><input type='text' name='unit' value='");
|
||||
reply += Settings.Unit;
|
||||
|
||||
reply += "'><BR>WPA AP Mode Key:<BR><input type='text' name='apkey' value='";
|
||||
reply += F("'><BR>WPA AP Mode Key:<BR><input type='text' name='apkey' value='");
|
||||
reply += Settings.WifiAPKey;
|
||||
|
||||
reply += "'><BR>Syslog IP:<BR><input type='text' name='syslogip' value='";
|
||||
reply += F("'><BR>Syslog IP:<BR><input type='text' name='syslogip' value='");
|
||||
str[0]=0;
|
||||
sprintf(str, "%u.%u.%u.%u", Settings.Syslog_IP[0], Settings.Syslog_IP[1], Settings.Syslog_IP[2], Settings.Syslog_IP[3]);
|
||||
reply += str;
|
||||
|
||||
reply += "'><BR><input type='submit' value='Submit'>";
|
||||
reply += "</form></body>";
|
||||
reply += F("'><BR><input type='submit' value='Submit'>");
|
||||
reply += F("</form></body>");
|
||||
server.send(200, "text/html", reply);
|
||||
delay(1000);
|
||||
|
||||
@@ -130,7 +130,7 @@ void handle_config() {
|
||||
//********************************************************************************
|
||||
void handle_devices() {
|
||||
|
||||
Serial.println("HTTP : Webdevices : ");
|
||||
Serial.println(F("HTTP : Webdevices : "));
|
||||
|
||||
String boardtype = server.arg("boardtype");
|
||||
String sensordelay = server.arg("delay");
|
||||
@@ -157,28 +157,28 @@ void handle_devices() {
|
||||
Save_Settings();
|
||||
}
|
||||
|
||||
String reply = "<body><form>";
|
||||
reply += "Delay:<BR><input type='text' name='delay' value='";
|
||||
String reply = F("<body><form>");
|
||||
reply += F("Delay:<BR><input type='text' name='delay' value='");
|
||||
reply += Settings.Delay;
|
||||
reply += "'><BR>Dallas:<BR><input type='text' name='dallas' value='";
|
||||
reply += F("'><BR>Dallas:<BR><input type='text' name='dallas' value='");
|
||||
reply += Settings.Dallas;
|
||||
reply += "'><BR>DHT:<BR><input type='text' name='dht' value='";
|
||||
reply += F("'><BR>DHT:<BR><input type='text' name='dht' value='");
|
||||
reply += Settings.DHT;
|
||||
reply += "'><BR>DHT Type:<BR><input type='text' name='dhttype' value='";
|
||||
reply += F("'><BR>DHT Type:<BR><input type='text' name='dhttype' value='");
|
||||
reply += Settings.DHTType;
|
||||
reply += "'><BR>BMP:<BR><input type='text' name='bmp' value='";
|
||||
reply += F("'><BR>BMP:<BR><input type='text' name='bmp' value='");
|
||||
reply += Settings.BMP;
|
||||
reply += "'><BR>LUX:<BR><input type='text' name='lux' value='";
|
||||
reply += F("'><BR>LUX:<BR><input type='text' name='lux' value='");
|
||||
reply += Settings.LUX;
|
||||
reply += "'><BR>RFID:<BR><input type='text' name='rfid' value='";
|
||||
reply += F("'><BR>RFID:<BR><input type='text' name='rfid' value='");
|
||||
reply += Settings.RFID;
|
||||
reply += "'><BR>Analog:<BR><input type='text' name='analog' value='";
|
||||
reply += F("'><BR>Analog:<BR><input type='text' name='analog' value='");
|
||||
reply += Settings.Analog;
|
||||
reply += "'><BR>Pulse:<BR><input type='text' name='pulse1' value='";
|
||||
reply += F("'><BR>Pulse:<BR><input type='text' name='pulse1' value='");
|
||||
reply += Settings.Pulse1;
|
||||
|
||||
reply += "'><BR><input type='submit' value='Submit'>";
|
||||
reply += "</form></body>";
|
||||
reply += F("'><BR><input type='submit' value='Submit'>");
|
||||
reply += F("</form></body>");
|
||||
server.send(200, "text/html", reply);
|
||||
delay(100);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void handle_devices() {
|
||||
//********************************************************************************
|
||||
void handle_hardware() {
|
||||
|
||||
Serial.println("HTTP : Hardware : ");
|
||||
Serial.println(F("HTTP : Hardware : "));
|
||||
|
||||
String boardtype = server.arg("boardtype");
|
||||
|
||||
@@ -242,20 +242,20 @@ void handle_hardware() {
|
||||
Save_Settings();
|
||||
}
|
||||
|
||||
String reply = "<body><form>";
|
||||
String reply = F("<body><form>");
|
||||
|
||||
reply +="Board Type:";
|
||||
byte choice = Settings.BoardType;
|
||||
String options[5];
|
||||
options[0]="ESP-07/12";
|
||||
options[1]="ESP-01 I2C";
|
||||
options[2]="ESP-01 In/Out";
|
||||
options[3]="ESP-01 2 x In";
|
||||
options[4]="ESP-01 2 x Out";
|
||||
reply +="<BR><select name='boardtype'>";
|
||||
options[0]=F("ESP-07/12");
|
||||
options[1]=F("ESP-01 I2C");
|
||||
options[2]=F("ESP-01 In/Out");
|
||||
options[3]=F("ESP-01 2 x In");
|
||||
options[4]=F("ESP-01 2 x Out");
|
||||
reply +=F("<BR><select name='boardtype'>");
|
||||
for (byte x=0; x<5;x++)
|
||||
{
|
||||
reply +="<option value='";
|
||||
reply +=F("<option value='");
|
||||
reply +=x;
|
||||
reply +="'";
|
||||
if (choice==x)
|
||||
@@ -264,54 +264,54 @@ void handle_hardware() {
|
||||
reply +=options[x];
|
||||
reply+="</option>";
|
||||
}
|
||||
reply +="</select>";
|
||||
reply +=F("</select>");
|
||||
|
||||
|
||||
|
||||
switch (Settings.BoardType)
|
||||
{
|
||||
case 0:
|
||||
reply +="<BR>SDA: ";
|
||||
reply +=F("<BR>SDA: ");
|
||||
reply += Settings.Pin_i2c_sda;
|
||||
reply +="<BR>SCL: ";
|
||||
reply +=F("<BR>SCL: ");
|
||||
reply += Settings.Pin_i2c_scl;
|
||||
reply +="<BR>Input 1: ";
|
||||
reply +=F("<BR>Input 1: ");
|
||||
reply += Settings.Pin_wired_in_1;
|
||||
reply +="<BR>Input 2: ";
|
||||
reply +=F("<BR>Input 2: ");
|
||||
reply += Settings.Pin_wired_in_2;
|
||||
reply +="<BR>Output 1: ";
|
||||
reply +=F("<BR>Output 1: ");
|
||||
reply += Settings.Pin_wired_out_1;
|
||||
reply +="<BR>Output 2: ";
|
||||
reply +=F("<BR>Output 2: ");
|
||||
reply += Settings.Pin_wired_out_2;
|
||||
break;
|
||||
case 1:
|
||||
reply +="<BR>SDA: ";
|
||||
reply +=F("<BR>SDA: ");
|
||||
reply += Settings.Pin_i2c_sda;
|
||||
reply +="<BR>SCL: ";
|
||||
reply +=F("<BR>SCL: ");
|
||||
reply += Settings.Pin_i2c_scl;
|
||||
break;
|
||||
case 2:
|
||||
reply +="<BR>Input 1: ";
|
||||
reply +=F("<BR>Input 1: ");
|
||||
reply += Settings.Pin_wired_in_1;
|
||||
reply +="<BR>Output 1: ";
|
||||
reply +=F("<BR>Output 1: ");
|
||||
reply += Settings.Pin_wired_out_1;
|
||||
break;
|
||||
case 3:
|
||||
reply +="<BR>Input 1: ";
|
||||
reply +=F("<BR>Input 1: ");
|
||||
reply += Settings.Pin_wired_in_1;
|
||||
reply +="<BR>Input 2: ";
|
||||
reply +=F("<BR>Input 2: ");
|
||||
reply += Settings.Pin_wired_in_2;
|
||||
break;
|
||||
case 4:
|
||||
reply +="<BR>Output 1: ";
|
||||
reply +=F("<BR>Output 1: ");
|
||||
reply += Settings.Pin_wired_out_1;
|
||||
reply +="<BR>Output 2: ";
|
||||
reply +=F("<BR>Output 2: ");
|
||||
reply += Settings.Pin_wired_out_2;
|
||||
break;
|
||||
}
|
||||
|
||||
reply += "<BR><input type='submit' value='Submit'>";
|
||||
reply += "</form></body>";
|
||||
reply += F("<BR><input type='submit' value='Submit'>");
|
||||
reply += F("</form></body>");
|
||||
server.send(200, "text/html", reply);
|
||||
delay(100);
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@ void WifiAPMode(boolean state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
Serial.println("WIFI : Starting AP Mode");
|
||||
Serial.println(F("WIFI : Starting AP Mode"));
|
||||
WiFi.softAP(ap_ssid, Settings.WifiAPKey);
|
||||
WiFi.mode(WIFI_AP_STA);
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("WIFI : Ending AP Mode");
|
||||
Serial.println(F("WIFI : Ending AP Mode"));
|
||||
WiFi.mode(WIFI_STA);
|
||||
}
|
||||
}
|
||||
|
||||
boolean WifiConnect()
|
||||
{
|
||||
Serial.println("WIFI : Connecting...");
|
||||
Serial.println(F("WIFI : Connecting..."));
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
if (Settings.WifiSSID[0] != 0)
|
||||
@@ -40,13 +40,13 @@ boolean WifiConnect()
|
||||
IPAddress gw = WiFi.gatewayIP();
|
||||
IPAddress subnet = WiFi.subnetMask();
|
||||
ip[3] = Settings.IP_Octet;
|
||||
Serial.print("IP : Fixed IP :");
|
||||
Serial.print(F("IP : Fixed IP :"));
|
||||
Serial.println(ip);
|
||||
WiFi.config(ip, gw, subnet);
|
||||
}
|
||||
}
|
||||
else
|
||||
Serial.println("WIFI : No SSID!");
|
||||
Serial.println(F("WIFI : No SSID!"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,20 +57,20 @@ boolean WifiDisconnect()
|
||||
|
||||
void WifiScan()
|
||||
{
|
||||
Serial.println("WIFI : SSID Scan start");
|
||||
Serial.println(F("WIFI : SSID Scan start"));
|
||||
int n = WiFi.scanNetworks();
|
||||
Serial.println("WIFI : Scan done");
|
||||
Serial.println(F("WIFI : Scan done"));
|
||||
if (n == 0)
|
||||
Serial.println("WIFI : No networks found");
|
||||
Serial.println(F("WIFI : No networks found"));
|
||||
else
|
||||
{
|
||||
Serial.print("WIFI : ");
|
||||
Serial.print(F("WIFI : "));
|
||||
Serial.print(n);
|
||||
Serial.println(" networks found");
|
||||
Serial.println(F(" networks found"));
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
// Print SSID and RSSI for each network found
|
||||
Serial.print("WIFI : ");
|
||||
Serial.print(F("WIFI : "));
|
||||
Serial.print(i + 1);
|
||||
Serial.print(": ");
|
||||
Serial.print(WiFi.SSID(i));
|
||||
@@ -104,7 +104,7 @@ void WifiCheck()
|
||||
C_Count++;
|
||||
if (C_Count > 30)
|
||||
{
|
||||
Serial.println("WIFI : Return to STA mode");
|
||||
Serial.println(F("WIFI : Return to STA mode"));
|
||||
NC_Count=0;
|
||||
AP_Mode=false;
|
||||
WifiAPMode(false);
|
||||
|
||||
+10
-2
@@ -28,6 +28,14 @@
|
||||
// Sends "WD <uptime in seconds> CF <connection failures>" to syslog if configured
|
||||
// Delayed reboot on empty IP adress (in case of DHCP issue)
|
||||
// Delayed reboot after 30 connection failures
|
||||
|
||||
// R004 18-05-2015
|
||||
|
||||
// R005 21-05-2015
|
||||
// Some fixes to be compabtible with Arduino 1.6.4 using ESP board addon 1.6.4.-628-g545ffde
|
||||
|
||||
// R006 23-05-2015
|
||||
// Stored many constant strings to progmem
|
||||
// delay(1) into http 'while' client check
|
||||
// delay(10) in main loop instead of yield()
|
||||
// DomoticzSend <type>,<idx>,<value> test command (via serial)
|
||||
// Disabled analogRead, seems broken in g8cd3697 (use millis()/1000 as demo value!)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user