|
@@ -1,7 +1,7 @@
|
|
|
// 1-channel LoRa Gateway for ESP8266
|
|
|
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
|
|
|
-// Version 6.1.4
|
|
|
-// Date: 2019-11-29
|
|
|
+// Version 6.1.5
|
|
|
+// Date: 2019-12-20
|
|
|
//
|
|
|
// based on work done by many people and making use of several libraries.
|
|
|
//
|
|
@@ -122,20 +122,18 @@ boolean YesNo()
|
|
|
void wwwFile(String fn) {
|
|
|
|
|
|
if (!SPIFFS.exists(fn)) {
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.print(F("wwwFile:: ERROR: file not found="));
|
|
|
- Serial.println(fn);
|
|
|
-#endif
|
|
|
+# if _MONITOR>=1
|
|
|
+ mPrint("wwwFile:: ERROR: SPIFFS file not found=");
|
|
|
+# endif
|
|
|
return;
|
|
|
- }
|
|
|
-#if _DUSB>=2
|
|
|
+ } // _MONITOR
|
|
|
+# if _MONITOR>=2
|
|
|
else {
|
|
|
- Serial.print(F("wwwFile:: File existist= "));
|
|
|
- Serial.println(fn);
|
|
|
+ mPrint("wwwFile:: SPIFFS File existist= " + String(fn));
|
|
|
}
|
|
|
-#endif
|
|
|
+# endif //_MONITOR
|
|
|
|
|
|
-#if _DUSB>=1
|
|
|
+# if _MONITOR>=1
|
|
|
File f = SPIFFS.open(fn, "r"); // Open the file for reading
|
|
|
|
|
|
int j;
|
|
@@ -153,7 +151,7 @@ void wwwFile(String fn) {
|
|
|
|
|
|
f.close();
|
|
|
|
|
|
-#endif
|
|
|
+# endif //_MONITOR
|
|
|
|
|
|
}
|
|
|
|
|
@@ -207,25 +205,6 @@ void buttonLog()
|
|
|
// server.sendContent(response);
|
|
|
}
|
|
|
|
|
|
-// --------------------------------------------------------------------------------
|
|
|
-// BUTTONSEEN
|
|
|
-// List the listSeen array.
|
|
|
-// Read the logfiles and display info about nodes (last seend, SF used etc).
|
|
|
-// This is a button on the top of the USB GUI screen
|
|
|
-// --------------------------------------------------------------------------------
|
|
|
-void buttonSeen()
|
|
|
-{
|
|
|
- String fn = "";
|
|
|
- int i = 0;
|
|
|
-
|
|
|
- printSeen(listSeen);
|
|
|
-#if _DUSB>=1
|
|
|
- if (( debug>=1 ) && ( pdebug & P_MAIN )) {
|
|
|
- Serial.println(F("buttonSeen:: printSeen called"));
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
// --------------------------------------------------------------------------------
|
|
|
// Navigate webpage by buttons. This method has some advantages:
|
|
@@ -236,15 +215,20 @@ static void wwwButtons()
|
|
|
{
|
|
|
String response = "";
|
|
|
String mode = (gwayConfig.expert ? "Basic Mode" : "Expert Mode");
|
|
|
+ String moni = (gwayConfig.monitor ? "Hide Monitor" : "Monitor ON");
|
|
|
+ String seen = (gwayConfig.seen ? "Seen OFF" : "Node last seen");
|
|
|
|
|
|
YesNo(); // Init the Yes/No function
|
|
|
buttonDocu();
|
|
|
|
|
|
response += "<input type=\"button\" value=\"Documentation\" onclick=\"showDocu()\" >";
|
|
|
+ response += "<a href=\"LOG\" download><button type=\"button\">Log Files</button></a>";
|
|
|
|
|
|
response += "<a href=\"EXPERT\" download><button type=\"button\">" + mode + "</button></a>";
|
|
|
- response += "<a href=\"SEEN\" download><button type=\"button\">Nodes Seen</button></a>";
|
|
|
- response += "<a href=\"LOG\" download><button type=\"button\">Log Files</button></a>";
|
|
|
+# if _MONITOR>=1
|
|
|
+ response += "<a href=\"MONITOR\" download><button type=\"button\">" +moni+ "</button></a>";
|
|
|
+# endif
|
|
|
+ response += "<a href=\"SEEN\" download><button type=\"button\">" +seen+ "</button></a>";
|
|
|
|
|
|
server.sendContent(response); // Send to the screen
|
|
|
}
|
|
@@ -427,17 +411,19 @@ static void openWebPage()
|
|
|
//
|
|
|
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
|
|
|
server.send(200, "text/html", "");
|
|
|
+ String tt=""; printIP((IPAddress)WiFi.localIP(),'.',tt); // Time with separator
|
|
|
+
|
|
|
#if A_REFRESH==1
|
|
|
if (gwayConfig.refresh) {
|
|
|
response += String() + "<!DOCTYPE HTML><HTML><HEAD><meta http-equiv='refresh' content='"+_WWW_INTERVAL+";http://";
|
|
|
- printIP((IPAddress)WiFi.localIP(),'.',response);
|
|
|
- response += "'><TITLE>ESP8266 1ch Gateway</TITLE>";
|
|
|
+ response += tt;
|
|
|
+ response += "'><TITLE>1ch Gateway " + String(tt) + "</TITLE>";
|
|
|
}
|
|
|
else {
|
|
|
- response += String() + "<!DOCTYPE HTML><HTML><HEAD><TITLE>ESP8266 1ch Gateway</TITLE>";
|
|
|
+ response += String("<!DOCTYPE HTML><HTML><HEAD><TITLE>1ch Gateway " + String(tt) + "</TITLE>");
|
|
|
}
|
|
|
#else
|
|
|
- response += String() + "<!DOCTYPE HTML><HTML><HEAD><TITLE>ESP8266 1ch Gateway</TITLE>";
|
|
|
+ response += String("<!DOCTYPE HTML><HTML><HEAD><TITLE>1ch Gateway " + String(tt) + "</TITLE>");
|
|
|
#endif
|
|
|
response += "<META HTTP-EQUIV='CONTENT-TYPE' CONTENT='text/html; charset=UTF-8'>";
|
|
|
response += "<META NAME='AUTHOR' CONTENT='M. Westenberg (mw1554@hotmail.com)'>";
|
|
@@ -460,13 +446,10 @@ static void openWebPage()
|
|
|
uint8_t _hour = hour(secs);
|
|
|
uint8_t _minute = minute(secs);
|
|
|
uint8_t _second = second(secs);
|
|
|
- response += String() + days + "-";
|
|
|
- if (_hour < 10) response += "0";
|
|
|
- response += String() + _hour + ":";
|
|
|
- if (_minute < 10) response += "0";
|
|
|
- response += String() + _minute + ":";
|
|
|
- if (_second < 10) response += "0";
|
|
|
- response += String() + _second;
|
|
|
+ response += String(days) + "-";
|
|
|
+ if (_hour < 10) response += "0"; response += String(_hour) + ":";
|
|
|
+ if (_minute < 10) response += "0"; response += String(_minute) + ":";
|
|
|
+ if (_second < 10) response += "0"; response += String(_second);
|
|
|
|
|
|
response +="<br>Current time "; // CURRENT TIME
|
|
|
stringTime(now(), response);
|
|
@@ -534,7 +517,7 @@ static void gatewaySettings()
|
|
|
response += "AUTO</td>";
|
|
|
}
|
|
|
else {
|
|
|
- response += String() + ifreq;
|
|
|
+ response += String(ifreq);
|
|
|
response +="</td>";
|
|
|
response +="<td class=\"cell\"><a href=\"FREQ=-1\"><button>-</button></a></td>";
|
|
|
response +="<td class=\"cell\"><a href=\"FREQ=1\"><button>+</button></a></td>";
|
|
@@ -553,23 +536,13 @@ static void gatewaySettings()
|
|
|
|
|
|
// Debugging options, only when _DUSB is set, otherwise no
|
|
|
// serial activity
|
|
|
-#if _DUSB>=1
|
|
|
+#if _DUSB>=1 || _MONITOR>=1
|
|
|
response +="<tr><td class=\"cell\">Debug Level</td><td class=\"cell\" colspan=\"2\">";
|
|
|
response +=debug;
|
|
|
response +="</td>";
|
|
|
response +="<td class=\"cell\"><a href=\"DEBUG=-1\"><button>-</button></a></td>";
|
|
|
response +="<td class=\"cell\"><a href=\"DEBUG=1\"><button>+</button></a></td>";
|
|
|
response +="</tr>";
|
|
|
-
|
|
|
- // Time Correction
|
|
|
- if (gwayConfig.expert) {
|
|
|
- response +="<tr><td class=\"cell\">Time Correction (uSec)</td><td class=\"cell\" colspan=\"2\">";
|
|
|
- response += gwayConfig.txDelay;
|
|
|
- response +="</td>";
|
|
|
- response +="<td class=\"cell\"><a href=\"DELAY=-1\"><button>-</button></a></td>";
|
|
|
- response +="<td class=\"cell\"><a href=\"DELAY=1\"><button>+</button></a></td>";
|
|
|
- response +="</tr>";
|
|
|
- }
|
|
|
|
|
|
// Debug Pattern
|
|
|
response +="<tr><td class=\"cell\">Debug pattern</td>";
|
|
@@ -664,6 +637,16 @@ static void gatewaySettings()
|
|
|
response +="</tr>";
|
|
|
#endif
|
|
|
|
|
|
+ // Time Correction DELAY
|
|
|
+ if (gwayConfig.expert) {
|
|
|
+ response +="<tr><td class=\"cell\">Time Correction (uSec)</td><td class=\"cell\" colspan=\"2\">";
|
|
|
+ response += gwayConfig.txDelay;
|
|
|
+ response +="</td>";
|
|
|
+ response +="<td class=\"cell\"><a href=\"DELAY=-1\"><button>-</button></a></td>";
|
|
|
+ response +="<td class=\"cell\"><a href=\"DELAY=1\"><button>+</button></a></td>";
|
|
|
+ response +="</tr>";
|
|
|
+ }
|
|
|
+
|
|
|
// Reset Accesspoint
|
|
|
#if _WIFIMANAGER==1
|
|
|
response +="<tr><td><tr><td>";
|
|
@@ -712,11 +695,11 @@ static void statisticsData()
|
|
|
response +="<h2>Package Statistics</h2>";
|
|
|
response +="<table class=\"config_table\">";
|
|
|
response +="<tr><th class=\"thead\">Counter</th>";
|
|
|
-#if _STATISTICS == 3
|
|
|
- response +="<th class=\"thead\">C 0</th>";
|
|
|
- response +="<th class=\"thead\">C 1</th>";
|
|
|
- response +="<th class=\"thead\">C 2</th>";
|
|
|
-#endif
|
|
|
+# if _STATISTICS == 3
|
|
|
+ response +="<th class=\"thead\">C 0</th>";
|
|
|
+ response +="<th class=\"thead\">C 1</th>";
|
|
|
+ response +="<th class=\"thead\">C 2</th>";
|
|
|
+# endif //_STATISTICS==3
|
|
|
response +="<th class=\"thead\">Pkgs</th>";
|
|
|
response +="<th class=\"thead\">Pkgs/hr</th>";
|
|
|
response +="</tr>";
|
|
@@ -725,35 +708,35 @@ static void statisticsData()
|
|
|
// Table rows
|
|
|
//
|
|
|
response +="<tr><td class=\"cell\">Packages Downlink</td>";
|
|
|
-#if _STATISTICS == 3
|
|
|
+# if _STATISTICS == 3
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_down_0) + "</td>";
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_down_1) + "</td>";
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_down_2) + "</td>";
|
|
|
-#endif
|
|
|
+# endif
|
|
|
response += "<td class=\"cell\">" + String(statc.msg_down) + "</td>";
|
|
|
response +="<td class=\"cell\"></td></tr>";
|
|
|
|
|
|
response +="<tr><td class=\"cell\">Packages Uplink Total</td>";
|
|
|
-#if _STATISTICS == 3
|
|
|
+# if _STATISTICS == 3
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ttl_0) + "</td>";
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ttl_1) + "</td>";
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ttl_2) + "</td>";
|
|
|
-#endif
|
|
|
- response +="<td class=\"cell\">" + String(statc.msg_ttl) + "</td>";
|
|
|
- response +="<td class=\"cell\">" + String((statc.msg_ttl*3600)/(now() - startTime)) + "</td></tr>";
|
|
|
+# endif //_STATISTICS==3
|
|
|
+ response +="<td class=\"cell\">" + String(statc.msg_ttl) + "</td>";
|
|
|
+ response +="<td class=\"cell\">" + String((statc.msg_ttl*3600)/(now() - startTime)) + "</td></tr>";
|
|
|
|
|
|
response +="<tr><td class=\"cell\">Packages Uplink OK </td>";
|
|
|
-#if _STATISTICS == 3
|
|
|
+#if _STATISTICS == 3
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ok_0) + "</td>";
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ok_1) + "</td>";
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ok_2) + "</td>";
|
|
|
-#endif
|
|
|
+# endif //_STATISTICS==3
|
|
|
response +="<td class=\"cell\">" + String(statc.msg_ok) + "</td>";
|
|
|
response +="<td class=\"cell\"></td></tr>";
|
|
|
|
|
|
|
|
|
// Provide a table with all the SF data including percentage of messsages
|
|
|
-#if _STATISTICS == 2
|
|
|
+ #if _STATISTICS == 2
|
|
|
response +="<tr><td class=\"cell\">SF7 rcvd</td>";
|
|
|
response +="<td class=\"cell\">"; response +=statc.sf7;
|
|
|
response +="<td class=\"cell\">"; response += String(statc.msg_ttl>0 ? 100*statc.sf7/statc.msg_ttl : 0)+" %";
|
|
@@ -778,8 +761,9 @@ static void statisticsData()
|
|
|
response +="<td class=\"cell\">"; response +=statc.sf12;
|
|
|
response +="<td class=\"cell\">"; response += String(statc.msg_ttl>0 ? 100*statc.sf12/statc.msg_ttl : 0)+" %";
|
|
|
response +="</td></tr>";
|
|
|
-#endif
|
|
|
-#if _STATISTICS == 3
|
|
|
+# endif //_STATISTICS==2
|
|
|
+
|
|
|
+# if _STATISTICS == 3
|
|
|
response +="<tr><td class=\"cell\">SF7 rcvd</td>";
|
|
|
response +="<td class=\"cell\">"; response +=statc.sf7_0;
|
|
|
response +="<td class=\"cell\">"; response +=statc.sf7_1;
|
|
@@ -827,7 +811,7 @@ static void statisticsData()
|
|
|
response +="<td class=\"cell\">"; response +=statc.sf12;
|
|
|
response +="<td class=\"cell\">"; response += String(statc.msg_ttl>0 ? 100*statc.sf12/statc.msg_ttl : 0)+" %";
|
|
|
response +="</td></tr>";
|
|
|
-#endif
|
|
|
+# endif //_STATISTICS==3
|
|
|
|
|
|
response +="</table>";
|
|
|
server.sendContent(response);
|
|
@@ -913,9 +897,9 @@ static void messageHistory()
|
|
|
break;
|
|
|
case 3: // Value and we do not print unless also defined for LOCAL_SERVER
|
|
|
default:
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println("Unknow value for gwayConfig.trusted");
|
|
|
-#endif
|
|
|
+# if _MONITOR>=1
|
|
|
+ mPrint("Unknow value for gwayConfig.trusted");
|
|
|
+# endif //_MONITOR
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -968,7 +952,7 @@ static void messageHistory()
|
|
|
static void nodeHistory()
|
|
|
{
|
|
|
#if _SEENMAX > 0
|
|
|
- if (gwayConfig.expert) {
|
|
|
+ if (gwayConfig.seen) {
|
|
|
// First draw the headers
|
|
|
String response="";
|
|
|
|
|
@@ -977,7 +961,7 @@ static void nodeHistory()
|
|
|
response += "<tr>";
|
|
|
response += "<th class=\"thead\" style=\"width: 220px;\">Time</th>";
|
|
|
response += "<th class=\"thead\">Node</th>";
|
|
|
- response += "<th class=\"thead\">Count</th>";
|
|
|
+ response += "<th class=\"thead\">Pkgs</th>";
|
|
|
//#if _LOCALSERVER==1
|
|
|
// response += "<th class=\"thead\">Data</th>";
|
|
|
//#endif
|
|
@@ -1013,21 +997,19 @@ static void nodeHistory()
|
|
|
break;
|
|
|
case 3: // Value 3 and we do not print unless also defined for LOCAL_SERVER
|
|
|
default:
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println("Unknow value for gwayConfig.trusted");
|
|
|
-#endif
|
|
|
+# if _MONITOR>=1
|
|
|
+ mPrint("Unknow value for gwayConfig.trusted");
|
|
|
+# endif //_MONITOR
|
|
|
break;
|
|
|
}
|
|
|
-#else // _TRUSTED_NODES
|
|
|
+#else
|
|
|
printHEX((char *)(& (listSeen[i].idSeen)),' ',response);
|
|
|
#endif // _TRUSTED_NODES
|
|
|
|
|
|
response += "</td>";
|
|
|
|
|
|
response += String() + "<td class=\"cell\">" + listSeen[i].cntSeen + "</td>"; // Counter
|
|
|
-
|
|
|
response += String() + "<td class=\"cell\">" + listSeen[i].chnSeen + "</td>"; // Channel
|
|
|
-
|
|
|
response += String() + "<td class=\"cell\">" + listSeen[i].sfSeen + "</td>"; // SF
|
|
|
|
|
|
server.sendContent(response);
|
|
@@ -1038,39 +1020,222 @@ static void nodeHistory()
|
|
|
} // nodeHistory()
|
|
|
|
|
|
|
|
|
+
|
|
|
// --------------------------------------------------------------------------------
|
|
|
-// SEND WEB PAGE()
|
|
|
-// Call the webserver and send the standard content and the content that is
|
|
|
-// passed by the parameter. Each time a variable is changed, this function is
|
|
|
-// called to display the webpage again/
|
|
|
-//
|
|
|
-// NOTE: This is the only place where yield() or delay() calls are used.
|
|
|
+// MONITOR DATA
|
|
|
+// This function will print monitor data for the gateway based on the settings in
|
|
|
+// _MONITOR in file configGway.h
|
|
|
+// Only when the _MONITOR is positive then the function will be executed.
|
|
|
+// If less then nothing will be displayed.
|
|
|
+// XXX We have to make the function such that when printed, the webpage refreshes.
|
|
|
+// --------------------------------------------------------------------------------
|
|
|
+int monitorData()
|
|
|
+{
|
|
|
+# if _MONITOR>=1
|
|
|
+ if (gwayConfig.monitor) {
|
|
|
+ String response="";
|
|
|
+ response +="<h2>Monitoring Console</h2>";
|
|
|
+
|
|
|
+ response +="<table class=\"config_table\">";
|
|
|
+ response +="<tr>";
|
|
|
+ response +="<th class=\"thead\">Monitor Console</th>";
|
|
|
+ response +="</tr>";
|
|
|
+
|
|
|
+
|
|
|
+ for (int i=0; i<_MONITOR; i++) {
|
|
|
+ if (monitor[i].txt == "") {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // DISPLAY line
|
|
|
+ response +="<tr><td class=\"cell\">" ;
|
|
|
+ response += String(monitor[i].txt);
|
|
|
+ response += "</td></tr>";
|
|
|
+ }
|
|
|
+ response +="</table>";
|
|
|
+ server.sendContent(response);
|
|
|
+ }
|
|
|
+# endif
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// --------------------------------------------------------------------------------
|
|
|
+// WIFI CONFIG
|
|
|
+// wifiConfig() displays the most important Wifi parameters gathered
|
|
|
//
|
|
|
// --------------------------------------------------------------------------------
|
|
|
-void sendWebPage(const char *cmd, const char *arg)
|
|
|
+static void wifiConfig()
|
|
|
{
|
|
|
- openWebPage(); yield(); // Do the initial website setup
|
|
|
+ if (gwayConfig.expert) {
|
|
|
+ String response="";
|
|
|
+ response +="<h2>WiFi Config</h2>";
|
|
|
+
|
|
|
+ response +="<table class=\"config_table\">";
|
|
|
+
|
|
|
+ response +="<tr><th class=\"thead\">Parameter</th><th class=\"thead\">Value</th></tr>";
|
|
|
|
|
|
- wwwButtons(); // Display buttons such as Documentation, Mode, Logfiles
|
|
|
+ response +="<tr><td class=\"cell\">WiFi host</td><td class=\"cell\">";
|
|
|
+#if ESP32_ARCH==1
|
|
|
+ response +=WiFi.getHostname(); response+="</tr>";
|
|
|
+#else
|
|
|
+ response +=wifi_station_get_hostname(); response+="</tr>";
|
|
|
+#endif
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">WiFi SSID</td><td class=\"cell\">";
|
|
|
+ response +=WiFi.SSID(); response+="</tr>";
|
|
|
|
|
|
- setVariables(cmd,arg); yield(); // Read Webserver commands from line
|
|
|
+ response +="<tr><td class=\"cell\">IP Address</td><td class=\"cell\">";
|
|
|
+ printIP((IPAddress)WiFi.localIP(),'.',response);
|
|
|
+ response +="</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">IP Gateway</td><td class=\"cell\">";
|
|
|
+ printIP((IPAddress)WiFi.gatewayIP(),'.',response);
|
|
|
+ response +="</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">NTP Server</td><td class=\"cell\">"; response+=NTP_TIMESERVER; response+="</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">LoRa Router</td><td class=\"cell\">"; response+=_TTNSERVER; response+="</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">LoRa Router IP</td><td class=\"cell\">";
|
|
|
+ printIP((IPAddress)ttnServer,'.',response);
|
|
|
+ response +="</tr>";
|
|
|
+#ifdef _THINGSERVER
|
|
|
+ response +="<tr><td class=\"cell\">LoRa Router 2</td><td class=\"cell\">"; response+=_THINGSERVER;
|
|
|
+ response += String() + ":" + _THINGPORT + "</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">LoRa Router 2 IP</td><td class=\"cell\">";
|
|
|
+ printIP((IPAddress)thingServer,'.',response);
|
|
|
+ response +="</tr>";
|
|
|
+#endif
|
|
|
|
|
|
- statisticsData(); yield(); // Node statistics
|
|
|
- messageHistory(); yield(); // Display the sensor history, message statistics
|
|
|
- nodeHistory(); yield(); // Display the lastSeen array
|
|
|
|
|
|
- gatewaySettings(); yield(); // Display web configuration
|
|
|
- wifiConfig(); yield(); // WiFi specific parameters
|
|
|
+ response +="</table>";
|
|
|
+
|
|
|
+ server.sendContent(response);
|
|
|
+ } // gwayConfig.expert
|
|
|
+} // wifiConfig
|
|
|
+
|
|
|
+
|
|
|
+// --------------------------------------------------------------------------------
|
|
|
+// H2 systemStatus
|
|
|
+// systemStatus is additional and only available in the expert mode.
|
|
|
+// It provides a number of system specific data such as heap size etc.
|
|
|
+// --------------------------------------------------------------------------------
|
|
|
+static void systemStatus()
|
|
|
+{
|
|
|
+ if (gwayConfig.expert) {
|
|
|
+ String response="";
|
|
|
+ response +="<h2>System Status</h2>";
|
|
|
|
|
|
- systemStatus(); yield(); // System statistics such as heap etc.
|
|
|
- interruptData(); yield(); // Display interrupts only when debug >= 2
|
|
|
+ response +="<table class=\"config_table\">";
|
|
|
+ response +="<tr>";
|
|
|
+ response +="<th class=\"thead\">Parameter</th>";
|
|
|
+ response +="<th class=\"thead\">Value</th>";
|
|
|
+ response +="<th colspan=\"2\" class=\"thead\">Set</th>";
|
|
|
+ response +="</tr>";
|
|
|
|
|
|
- websiteFooter(); yield();
|
|
|
+ response +="<tr><td style=\"border: 1px solid black; width:120px;\">Gateway ID</td>";
|
|
|
+ response +="<td class=\"cell\">";
|
|
|
+ if (MAC_array[0]< 0x10) response +='0'; response +=String(MAC_array[0],HEX); // The MAC array is always returned in lowercase
|
|
|
+ if (MAC_array[1]< 0x10) response +='0'; response +=String(MAC_array[1],HEX);
|
|
|
+ if (MAC_array[2]< 0x10) response +='0'; response +=String(MAC_array[2],HEX);
|
|
|
+ response +="FFFF";
|
|
|
+ if (MAC_array[3]< 0x10) response +='0'; response +=String(MAC_array[3],HEX);
|
|
|
+ if (MAC_array[4]< 0x10) response +='0'; response +=String(MAC_array[4],HEX);
|
|
|
+ if (MAC_array[5]< 0x10) response +='0'; response +=String(MAC_array[5],HEX);
|
|
|
+ response+="</tr>";
|
|
|
|
|
|
|
|
|
-
|
|
|
- server.client().stop();
|
|
|
-}
|
|
|
+ response +="<tr><td class=\"cell\">Free heap</td><td class=\"cell\">"; response+=ESP.getFreeHeap(); response+="</tr>";
|
|
|
+// XXX We Shoudl find an ESP32 alternative
|
|
|
+#if !defined ESP32_ARCH
|
|
|
+ response +="<tr><td class=\"cell\">ESP speed</td><td class=\"cell\">"; response+=ESP.getCpuFreqMHz();
|
|
|
+ response +="<td style=\"border: 1px solid black; width:40px;\"><a href=\"SPEED=80\"><button>80</button></a></td>";
|
|
|
+ response +="<td style=\"border: 1px solid black; width:40px;\"><a href=\"SPEED=160\"><button>160</button></a></td>";
|
|
|
+ response+="</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">ESP Chip ID</td><td class=\"cell\">"; response+=ESP.getChipId(); response+="</tr>";
|
|
|
+#endif
|
|
|
+ response +="<tr><td class=\"cell\">OLED</td><td class=\"cell\">"; response+=OLED; response+="</tr>";
|
|
|
+
|
|
|
+#if _STATISTICS >= 1
|
|
|
+ response +="<tr><td class=\"cell\">WiFi Setups</td><td class=\"cell\">"; response+=gwayConfig.wifis; response+="</tr>";
|
|
|
+ response +="<tr><td class=\"cell\">WWW Views</td><td class=\"cell\">"; response+=gwayConfig.views; response+="</tr>";
|
|
|
+#endif
|
|
|
+
|
|
|
+ response +="</table>";
|
|
|
+ server.sendContent(response);
|
|
|
+ } // gwayConfig.expert
|
|
|
+} // systemStatus
|
|
|
+
|
|
|
+
|
|
|
+// --------------------------------------------------------------------------------
|
|
|
+// H2 System State and Interrupt
|
|
|
+// Display interrupt data, but only for debug >= 2
|
|
|
+//
|
|
|
+// --------------------------------------------------------------------------------
|
|
|
+static void interruptData()
|
|
|
+{
|
|
|
+ if (gwayConfig.expert) {
|
|
|
+ uint8_t flags = readRegister(REG_IRQ_FLAGS);
|
|
|
+ uint8_t mask = readRegister(REG_IRQ_FLAGS_MASK);
|
|
|
+ String response="";
|
|
|
+
|
|
|
+ response +="<h2>System State and Interrupt</h2>";
|
|
|
+
|
|
|
+ response +="<table class=\"config_table\">";
|
|
|
+ response +="<tr>";
|
|
|
+ response +="<th class=\"thead\">Parameter</th>";
|
|
|
+ response +="<th class=\"thead\">Value</th>";
|
|
|
+ response +="<th colspan=\"2\" class=\"thead\">Set</th>";
|
|
|
+ response +="</tr>";
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">_state</td>";
|
|
|
+ response +="<td class=\"cell\">";
|
|
|
+ switch (_state) { // See loraModem.h
|
|
|
+ case S_INIT: response +="INIT"; break;
|
|
|
+ case S_SCAN: response +="SCAN"; break;
|
|
|
+ case S_CAD: response +="CAD"; break;
|
|
|
+ case S_RX: response +="RX"; break;
|
|
|
+ case S_TX: response +="TX"; break;
|
|
|
+ default: response +="unknown"; break;
|
|
|
+ }
|
|
|
+ response +="</td></tr>";
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">_STRICT_1CH</td>";
|
|
|
+ response +="<td class=\"cell\">" ;
|
|
|
+ response += String() + _STRICT_1CH;
|
|
|
+ response +="</td></tr>";
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">flags (8 bits)</td>";
|
|
|
+ response +="<td class=\"cell\">0x";
|
|
|
+ if (flags <16) response += "0";
|
|
|
+ response +=String(flags,HEX); response+="</td></tr>";
|
|
|
+
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">mask (8 bits)</td>";
|
|
|
+ response +="<td class=\"cell\">0x";
|
|
|
+ if (mask <16) response += "0";
|
|
|
+ response +=String(mask,HEX); response+="</td></tr>";
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">Re-entrant cntr</td>";
|
|
|
+ response +="<td class=\"cell\">";
|
|
|
+ response += String() + gwayConfig.reents;
|
|
|
+ response +="</td></tr>";
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">ntp call cntr</td>";
|
|
|
+ response +="<td class=\"cell\">";
|
|
|
+ response += String() + gwayConfig.ntps;
|
|
|
+ response+="</td></tr>";
|
|
|
+
|
|
|
+ response +="<tr><td class=\"cell\">ntpErr cntr</td>";
|
|
|
+ response +="<td class=\"cell\">";
|
|
|
+ response += String() + gwayConfig.ntpErr;
|
|
|
+ response +="</td>";
|
|
|
+ response +="<td colspan=\"2\" style=\"border: 1px solid black;\">";
|
|
|
+ stringTime(gwayConfig.ntpErrTime, response);
|
|
|
+ response +="</td>";
|
|
|
+ response +="</tr>";
|
|
|
+
|
|
|
+ response +="</table>";
|
|
|
+
|
|
|
+ server.sendContent(response);
|
|
|
+ }// if gwayConfig.expert
|
|
|
+} // interruptData
|
|
|
+
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------
|
|
@@ -1111,9 +1276,11 @@ void setupWWW()
|
|
|
initConfig(&gwayConfig);
|
|
|
writeConfig( CONFIGFILE, &gwayConfig);
|
|
|
writeSeen( _SEENFILE, listSeen); // Write the last time record is seen
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("DONE"));
|
|
|
-#endif
|
|
|
+# if _MONITOR>=1
|
|
|
+ if ((debug>=1) && (pdebug & P_GUI )) {
|
|
|
+ mPrint("Format DONE");
|
|
|
+ }
|
|
|
+# endif //_MONITOR
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
@@ -1177,15 +1344,25 @@ void setupWWW()
|
|
|
gwayConfig.ntps = 0; // Number of NTP calls
|
|
|
#endif
|
|
|
gwayConfig.reents = 0; // Re-entrance
|
|
|
-
|
|
|
writeGwayCfg(CONFIGFILE);
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("BOOT, config written"));
|
|
|
+#if _MONITOR>=1
|
|
|
+ if ((debug>=2) && (pdebug & P_MAIN)) {
|
|
|
+ mPrint("BOOT, config written");
|
|
|
+ }
|
|
|
#endif
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
|
|
|
+ // Reboot the Gateway
|
|
|
+ // NOTE: There is no button for this code yet
|
|
|
+ server.on("/REBOOT", []() {
|
|
|
+ sendWebPage("",""); // Send the webPage string
|
|
|
+ server.sendHeader("Location", String("/"), true);
|
|
|
+ server.send ( 302, "text/plain", "");
|
|
|
+ ESP.restart();
|
|
|
+ });
|
|
|
+
|
|
|
server.on("/NEWSSID", []() {
|
|
|
sendWebPage("NEWSSID",""); // Send the webPage string
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
@@ -1193,46 +1370,50 @@ void setupWWW()
|
|
|
});
|
|
|
|
|
|
// Set debug parameter
|
|
|
- server.on("/DEBUG=-1", []() { // Set debug level 0-2
|
|
|
+ server.on("/DEBUG=-1", []() { // Set debug level 0-2. Note: +3 is same as -1
|
|
|
debug = (debug+3)%4;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("DEBUG -1: config written"));
|
|
|
-#endif
|
|
|
+# if _DUSB>=1 || _MONITOR>=1
|
|
|
+ if ((debug>=1) && (pdebug & P_MAIN)) {
|
|
|
+ mPrint("DEBUG -1: config written");
|
|
|
+ }
|
|
|
+# endif // _DUSB _MONITOR
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
server.on("/DEBUG=1", []() {
|
|
|
debug = (debug+1)%4;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("DEBUG +1: config written"));
|
|
|
-#endif
|
|
|
+# if _DUSB>=1 || _MONITOR>=1
|
|
|
+ if ((debug>=1) && (pdebug & P_MAIN)) {
|
|
|
+ mPrint("DEBUG +1: config written");
|
|
|
+ }
|
|
|
+# endif // _DUSB _MONITOR
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
|
|
|
// Set PDEBUG parameter
|
|
|
//
|
|
|
- server.on("/PDEBUG=SCAN", []() { // Set debug level 0-2
|
|
|
+ server.on("/PDEBUG=SCAN", []() { // Set debug level 0x01
|
|
|
pdebug ^= P_SCAN;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
- server.on("/PDEBUG=CAD", []() { // Set debug level 0-2
|
|
|
+ server.on("/PDEBUG=CAD", []() { // Set debug level 0x02
|
|
|
pdebug ^= P_CAD;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
- server.on("/PDEBUG=RX", []() { // Set debug level 0-2
|
|
|
+ server.on("/PDEBUG=RX", []() { // Set debug level 0x04
|
|
|
pdebug ^= P_RX;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
- server.on("/PDEBUG=TX", []() { // Set debug level 0-2
|
|
|
+ server.on("/PDEBUG=TX", []() { // Set debug level 0x08
|
|
|
pdebug ^= P_TX;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
@@ -1268,18 +1449,22 @@ void setupWWW()
|
|
|
server.on("/DELAY=1", []() {
|
|
|
gwayConfig.txDelay+=5000;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("DELAY +, config written"));
|
|
|
-#endif
|
|
|
+# if _MONITOR>=1
|
|
|
+ if ((debug>=1) && (pdebug & P_MAIN)) {
|
|
|
+ mPrint("DELAY +, config written");
|
|
|
+ }
|
|
|
+# endif
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
server.on("/DELAY=-1", []() {
|
|
|
gwayConfig.txDelay-=5000;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("DELAY +, config written"));
|
|
|
-#endif
|
|
|
+# if _MONITOR>=1
|
|
|
+ if ((debug>=1) && (pdebug & P_MAIN)) {
|
|
|
+ mPrint("DELAY -, config written");
|
|
|
+ }
|
|
|
+# endif
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
@@ -1288,9 +1473,9 @@ void setupWWW()
|
|
|
server.on("/TRUSTED=1", []() {
|
|
|
gwayConfig.trusted = (gwayConfig.trusted +1)%4;
|
|
|
writeGwayCfg(CONFIGFILE); // Save configuration to file
|
|
|
-#if _DUSB>=2
|
|
|
- Serial.println(F("TRUSTED +, config written"));
|
|
|
-#endif
|
|
|
+# if _MONITOR>=2
|
|
|
+ mPrint("TRUSTED +, config written");
|
|
|
+# endif //_MONITOR
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
@@ -1451,15 +1636,20 @@ void setupWWW()
|
|
|
gwayConfig.expert = bool(1 - (int) gwayConfig.expert) ;
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
+
|
|
|
+#if _MONITOR>=1
|
|
|
+ // Display Monitor Console or not
|
|
|
+ server.on("/MONITOR", []() {
|
|
|
+ server.sendHeader("Location", String("/"), true);
|
|
|
+ gwayConfig.monitor = bool(1 - (int) gwayConfig.monitor) ;
|
|
|
+ server.send ( 302, "text/plain", "");
|
|
|
+ });
|
|
|
+#endif
|
|
|
|
|
|
// Display the SEEN statistics
|
|
|
server.on("/SEEN", []() {
|
|
|
server.sendHeader("Location", String("/"), true);
|
|
|
-#if _DUSB>=1
|
|
|
- Serial.println(F("SEEN button"));
|
|
|
- printSeen(listSeen);
|
|
|
-#endif
|
|
|
- buttonSeen();
|
|
|
+ gwayConfig.seen = bool(1 - (int) gwayConfig.seen) ;
|
|
|
server.send ( 302, "text/plain", "");
|
|
|
});
|
|
|
|
|
@@ -1479,191 +1669,45 @@ void setupWWW()
|
|
|
// Maybe not all information should be put on the screen since it
|
|
|
// may take too much time to serve all information before a next
|
|
|
// package interrupt arrives at the gateway
|
|
|
-
|
|
|
- Serial.print(F("WWW Server started on port "));
|
|
|
- Serial.println(A_SERVERPORT);
|
|
|
+# if _DUSB>=1
|
|
|
+ Serial.print(F("WWW Server started on port "));
|
|
|
+ Serial.println(A_SERVERPORT);
|
|
|
+# endif //_DUSB
|
|
|
+
|
|
|
return;
|
|
|
} // setupWWW
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// --------------------------------------------------------------------------------
|
|
|
-// WIFI CONFIG
|
|
|
-// wifiConfig() displays the most important Wifi parameters gathered
|
|
|
+// SEND WEB PAGE()
|
|
|
+// Call the webserver and send the standard content and the content that is
|
|
|
+// passed by the parameter. Each time a variable is changed, this function is
|
|
|
+// called to display the webpage again/
|
|
|
+//
|
|
|
+// NOTE: This is the only place where yield() or delay() calls are used.
|
|
|
//
|
|
|
// --------------------------------------------------------------------------------
|
|
|
-static void wifiConfig()
|
|
|
+void sendWebPage(const char *cmd, const char *arg)
|
|
|
{
|
|
|
- if (gwayConfig.expert) {
|
|
|
- String response="";
|
|
|
- response +="<h2>WiFi Config</h2>";
|
|
|
-
|
|
|
- response +="<table class=\"config_table\">";
|
|
|
-
|
|
|
- response +="<tr><th class=\"thead\">Parameter</th><th class=\"thead\">Value</th></tr>";
|
|
|
+ openWebPage(); yield(); // Do the initial website setup
|
|
|
|
|
|
- response +="<tr><td class=\"cell\">WiFi host</td><td class=\"cell\">";
|
|
|
-#if ESP32_ARCH==1
|
|
|
- response +=WiFi.getHostname(); response+="</tr>";
|
|
|
-#else
|
|
|
- response +=wifi_station_get_hostname(); response+="</tr>";
|
|
|
-#endif
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">WiFi SSID</td><td class=\"cell\">";
|
|
|
- response +=WiFi.SSID(); response+="</tr>";
|
|
|
+ wwwButtons(); // Display buttons such as Documentation, Mode, Logfiles
|
|
|
|
|
|
- response +="<tr><td class=\"cell\">IP Address</td><td class=\"cell\">";
|
|
|
- printIP((IPAddress)WiFi.localIP(),'.',response);
|
|
|
- response +="</tr>";
|
|
|
- response +="<tr><td class=\"cell\">IP Gateway</td><td class=\"cell\">";
|
|
|
- printIP((IPAddress)WiFi.gatewayIP(),'.',response);
|
|
|
- response +="</tr>";
|
|
|
- response +="<tr><td class=\"cell\">NTP Server</td><td class=\"cell\">"; response+=NTP_TIMESERVER; response+="</tr>";
|
|
|
- response +="<tr><td class=\"cell\">LoRa Router</td><td class=\"cell\">"; response+=_TTNSERVER; response+="</tr>";
|
|
|
- response +="<tr><td class=\"cell\">LoRa Router IP</td><td class=\"cell\">";
|
|
|
- printIP((IPAddress)ttnServer,'.',response);
|
|
|
- response +="</tr>";
|
|
|
-#ifdef _THINGSERVER
|
|
|
- response +="<tr><td class=\"cell\">LoRa Router 2</td><td class=\"cell\">"; response+=_THINGSERVER;
|
|
|
- response += String() + ":" + _THINGPORT + "</tr>";
|
|
|
- response +="<tr><td class=\"cell\">LoRa Router 2 IP</td><td class=\"cell\">";
|
|
|
- printIP((IPAddress)thingServer,'.',response);
|
|
|
- response +="</tr>";
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
- response +="</table>";
|
|
|
-
|
|
|
- server.sendContent(response);
|
|
|
- } // gwayConfig.expert
|
|
|
-} // wifiConfig
|
|
|
-
|
|
|
+ setVariables(cmd,arg); yield(); // Read Webserver commands from line
|
|
|
|
|
|
-// --------------------------------------------------------------------------------
|
|
|
-// H2 systemStatus
|
|
|
-// systemStatus is additional and only available in the expert mode.
|
|
|
-// It provides a number of system specific data such as heap size etc.
|
|
|
-// --------------------------------------------------------------------------------
|
|
|
-static void systemStatus()
|
|
|
-{
|
|
|
- if (gwayConfig.expert) {
|
|
|
- String response="";
|
|
|
- response +="<h2>System Status</h2>";
|
|
|
-
|
|
|
- response +="<table class=\"config_table\">";
|
|
|
- response +="<tr>";
|
|
|
- response +="<th class=\"thead\">Parameter</th>";
|
|
|
- response +="<th class=\"thead\">Value</th>";
|
|
|
- response +="<th colspan=\"2\" class=\"thead\">Set</th>";
|
|
|
- response +="</tr>";
|
|
|
-
|
|
|
- response +="<tr><td style=\"border: 1px solid black; width:120px;\">Gateway ID</td>";
|
|
|
- response +="<td class=\"cell\">";
|
|
|
- if (MAC_array[0]< 0x10) response +='0'; response +=String(MAC_array[0],HEX); // The MAC array is always returned in lowercase
|
|
|
- if (MAC_array[1]< 0x10) response +='0'; response +=String(MAC_array[1],HEX);
|
|
|
- if (MAC_array[2]< 0x10) response +='0'; response +=String(MAC_array[2],HEX);
|
|
|
- response +="FFFF";
|
|
|
- if (MAC_array[3]< 0x10) response +='0'; response +=String(MAC_array[3],HEX);
|
|
|
- if (MAC_array[4]< 0x10) response +='0'; response +=String(MAC_array[4],HEX);
|
|
|
- if (MAC_array[5]< 0x10) response +='0'; response +=String(MAC_array[5],HEX);
|
|
|
- response+="</tr>";
|
|
|
+ statisticsData(); yield(); // Node statistics
|
|
|
+ messageHistory(); yield(); // Display the sensor history, message statistics
|
|
|
+ nodeHistory(); yield(); // Display the lastSeen array
|
|
|
+ monitorData(); yield(); // Console
|
|
|
|
|
|
+ gatewaySettings(); yield(); // Display web configuration
|
|
|
+ wifiConfig(); yield(); // WiFi specific parameters
|
|
|
+ systemStatus(); yield(); // System statistics such as heap etc.
|
|
|
+ interruptData(); yield(); // Display interrupts only when debug >= 2
|
|
|
|
|
|
- response +="<tr><td class=\"cell\">Free heap</td><td class=\"cell\">"; response+=ESP.getFreeHeap(); response+="</tr>";
|
|
|
-// XXX We Shoudl find an ESP32 alternative
|
|
|
-#if !defined ESP32_ARCH
|
|
|
- response +="<tr><td class=\"cell\">ESP speed</td><td class=\"cell\">"; response+=ESP.getCpuFreqMHz();
|
|
|
- response +="<td style=\"border: 1px solid black; width:40px;\"><a href=\"SPEED=80\"><button>80</button></a></td>";
|
|
|
- response +="<td style=\"border: 1px solid black; width:40px;\"><a href=\"SPEED=160\"><button>160</button></a></td>";
|
|
|
- response+="</tr>";
|
|
|
- response +="<tr><td class=\"cell\">ESP Chip ID</td><td class=\"cell\">"; response+=ESP.getChipId(); response+="</tr>";
|
|
|
-#endif
|
|
|
- response +="<tr><td class=\"cell\">OLED</td><td class=\"cell\">"; response+=OLED; response+="</tr>";
|
|
|
-
|
|
|
-#if _STATISTICS >= 1
|
|
|
- response +="<tr><td class=\"cell\">WiFi Setups</td><td class=\"cell\">"; response+=gwayConfig.wifis; response+="</tr>";
|
|
|
- response +="<tr><td class=\"cell\">WWW Views</td><td class=\"cell\">"; response+=gwayConfig.views; response+="</tr>";
|
|
|
-#endif
|
|
|
-
|
|
|
- response +="</table>";
|
|
|
- server.sendContent(response);
|
|
|
- } // gwayConfig.expert
|
|
|
-} // systemStatus
|
|
|
-
|
|
|
-
|
|
|
-// --------------------------------------------------------------------------------
|
|
|
-// H2 System State and Interrupt
|
|
|
-// Display interrupt data, but only for debug >= 2
|
|
|
-//
|
|
|
-// --------------------------------------------------------------------------------
|
|
|
-static void interruptData()
|
|
|
-{
|
|
|
- if (gwayConfig.expert) {
|
|
|
- uint8_t flags = readRegister(REG_IRQ_FLAGS);
|
|
|
- uint8_t mask = readRegister(REG_IRQ_FLAGS_MASK);
|
|
|
- String response="";
|
|
|
-
|
|
|
- response +="<h2>System State and Interrupt</h2>";
|
|
|
-
|
|
|
- response +="<table class=\"config_table\">";
|
|
|
- response +="<tr>";
|
|
|
- response +="<th class=\"thead\">Parameter</th>";
|
|
|
- response +="<th class=\"thead\">Value</th>";
|
|
|
- response +="<th colspan=\"2\" class=\"thead\">Set</th>";
|
|
|
- response +="</tr>";
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">_state</td>";
|
|
|
- response +="<td class=\"cell\">";
|
|
|
- switch (_state) { // See loraModem.h
|
|
|
- case S_INIT: response +="INIT"; break;
|
|
|
- case S_SCAN: response +="SCAN"; break;
|
|
|
- case S_CAD: response +="CAD"; break;
|
|
|
- case S_RX: response +="RX"; break;
|
|
|
- case S_TX: response +="TX"; break;
|
|
|
- default: response +="unknown"; break;
|
|
|
- }
|
|
|
- response +="</td></tr>";
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">_STRICT_1CH</td>";
|
|
|
- response +="<td class=\"cell\">" ;
|
|
|
- response += String() + _STRICT_1CH;
|
|
|
- response +="</td></tr>";
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">flags (8 bits)</td>";
|
|
|
- response +="<td class=\"cell\">0x";
|
|
|
- if (flags <16) response += "0";
|
|
|
- response +=String(flags,HEX); response+="</td></tr>";
|
|
|
-
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">mask (8 bits)</td>";
|
|
|
- response +="<td class=\"cell\">0x";
|
|
|
- if (mask <16) response += "0";
|
|
|
- response +=String(mask,HEX); response+="</td></tr>";
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">Re-entrant cntr</td>";
|
|
|
- response +="<td class=\"cell\">";
|
|
|
- response += String() + gwayConfig.reents;
|
|
|
- response +="</td></tr>";
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">ntp call cntr</td>";
|
|
|
- response +="<td class=\"cell\">";
|
|
|
- response += String() + gwayConfig.ntps;
|
|
|
- response+="</td></tr>";
|
|
|
-
|
|
|
- response +="<tr><td class=\"cell\">ntpErr cntr</td>";
|
|
|
- response +="<td class=\"cell\">";
|
|
|
- response += String() + gwayConfig.ntpErr;
|
|
|
- response +="</td>";
|
|
|
- response +="<td colspan=\"2\" style=\"border: 1px solid black;\">";
|
|
|
- stringTime(gwayConfig.ntpErrTime, response);
|
|
|
- response +="</td>";
|
|
|
- response +="</tr>";
|
|
|
-
|
|
|
- response +="</table>";
|
|
|
-
|
|
|
- server.sendContent(response);
|
|
|
- }// if gwayConfig.expert
|
|
|
-} // interruptData
|
|
|
+ websiteFooter(); yield();
|
|
|
+
|
|
|
+ server.client().stop();
|
|
|
+}
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------
|