diff --git a/HTML/espfs.paths b/HTML/espfs.paths index d16710f..819c2e4 100644 --- a/HTML/espfs.paths +++ b/HTML/espfs.paths @@ -5,14 +5,8 @@ favicon.ico gendata.json head.inc index.html -index20.html -index21.html -index22.html index23.html index30.html -index31.html -index32.html -index33.html index40.html index41.html ioscr.js @@ -29,6 +23,12 @@ reboot.html set1.json set2.json set3.json +set_eth.html +set_gprs.html +set_mqtt.html +set_sys.html +set_time.html +set_wifi.html stat.json status.json style.css diff --git a/HTML/index.html b/HTML/index.html index 6a3949c..7f5a050 100644 --- a/HTML/index.html +++ b/HTML/index.html @@ -7,36 +7,11 @@ Home|State[?]
-
Станция 'Etherbox-07'
+
Your device name'
?
Время работы:?

-Входное напряжение:? В
-Системное напряжение:? В
-Напряжение батареи:? В
Уровень WiFi:?
-
- -
- - - - - - - - - -
Район 1
Район 2
Район 3
Район 4
Район 5
Район 6
Район 7
Район 8
-
- - - - - -
Система
Питание
Батарея
Связь
-
-
@@ -45,56 +20,18 @@ var tmr; function updateStatus(xmlData) { var dat = JSON.parse(xmlData); var theDate,sec,wl,volt,dnam; -var zr,zy,zg; -var sr,sy,sg; try{ theDate = new Date(dat.time * 1000); sec = dat.uptime; wl = dat.wlev; -volt = dat.vlsys; -volt2 = dat.vlin; -volt3 = dat.vlbat; dnam = dat.dname; -zr = dat.zred; -zy = dat.zyel; -zg = dat.zgrn; -sr = dat.sred; -sy = dat.syel; -sg = dat.sgrn; } catch(e){return;} - -volt = (volt*4.7/1000).toFixed(1); -volt2 = (volt2*11/1000+1.4).toFixed(1); -volt3 = (volt3*6.8/1000).toFixed(1); - document.getElementById('localtime').innerHTML = (theDate.toString()).slice(0,34); document.getElementById('uptime').innerHTML= secondsToHms(sec); -document.getElementById('volt').innerHTML= volt; -document.getElementById('volt2').innerHTML= volt2; -document.getElementById('volt3').innerHTML= volt3; document.getElementById('wlev').innerHTML= wl; document.getElementById('dn').innerHTML= dnam; -for(i=1; i<=8; ++i) - { - document.getElementById('led'+i).style.backgroundColor = '#d0d0d0' - if(zg & 1) document.getElementById('led'+i).style.backgroundColor = '#00cc00'; - if(zy & 1) document.getElementById('led'+i).style.backgroundColor = '#ffff00'; - if(zr & 1) document.getElementById('led'+i).style.backgroundColor = '#ff0000'; - zg >>=1; - zy >>=1; - zr >>=1; - } -for(i=1;i<=4;++i) - { - document.getElementById('sys'+i).style.backgroundColor = '#d0d0d0' - if(sg & 8) document.getElementById('sys'+i).style.backgroundColor = '#00cc00'; - if(sy & 8) document.getElementById('sys'+i).style.backgroundColor = '#ffff00'; - if(sr & 8) document.getElementById('sys'+i).style.backgroundColor = '#ff0000'; - sg <<=1; - sy <<=1; - sr <<=1; - } + function secondsToHms(d) { d = Number(d); var dd = Math.floor(d/86400); diff --git a/HTML/ioscr.js b/HTML/ioscr.js index a5fb040..5518dfb 100644 --- a/HTML/ioscr.js +++ b/HTML/ioscr.js @@ -30,14 +30,14 @@ document.write("
  • Статистика
  • Настройки"); +document.write("
  • MQTT
  • "); +document.write("
  • System
  • "); +document.write("
  • Time
  • "); document.write("
  • Сеть
  • "); document.write("");} diff --git a/HTML/index20.html b/HTML/set_eth.html similarity index 100% rename from HTML/index20.html rename to HTML/set_eth.html diff --git a/HTML/index22.html b/HTML/set_gprs.html similarity index 100% rename from HTML/index22.html rename to HTML/set_gprs.html diff --git a/HTML/index31.html b/HTML/set_mqtt.html similarity index 100% rename from HTML/index31.html rename to HTML/set_mqtt.html diff --git a/HTML/index32.html b/HTML/set_sys.html similarity index 100% rename from HTML/index32.html rename to HTML/set_sys.html diff --git a/HTML/index33.html b/HTML/set_time.html similarity index 100% rename from HTML/index33.html rename to HTML/set_time.html diff --git a/HTML/index21.html b/HTML/set_wifi.html similarity index 100% rename from HTML/index21.html rename to HTML/set_wifi.html diff --git a/components/WebGUIAppComponent b/components/WebGUIAppComponent index 4b8b8a3..f4ee6c2 160000 --- a/components/WebGUIAppComponent +++ b/components/WebGUIAppComponent @@ -1 +1 @@ -Subproject commit 4b8b8a36d327713a0c08998a7d11b538fd3a8a06 +Subproject commit f4ee6c25c7c93db384e47fdf0cac1027498e87de diff --git a/main/HTTPPrintCustom.c b/main/HTTPPrintCustom.c index a1696c7..2b92f6f 100644 --- a/main/HTTPPrintCustom.c +++ b/main/HTTPPrintCustom.c @@ -28,11 +28,6 @@ static void HTTPPrint_DEF(char *VarData, void *arg) snprintf(VarData, MAX_DYNVAR_LENGTH, "#DEF"); } -void HTTPPrint_topic2(char *VarData, void *arg) -{ - snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", "custom-dyn_var"); -} - static void HTTPPrint_status_fail(char *VarData, void *arg) { snprintf(VarData, MAX_DYNVAR_LENGTH, "none"); @@ -41,7 +36,6 @@ static void HTTPPrint_status_fail(char *VarData, void *arg) dyn_var_handler_t HANDLERS_ARRAY_CUST[] = { /*ERROR report*/ - { "topic2", sizeof("topic2") - 1, &HTTPPrint_topic2 }, { "status_fail", sizeof("status_fail") - 1, &HTTPPrint_status_fail }, }; @@ -50,33 +44,13 @@ dyn_var_handler_t HANDLERS_ARRAY_CUST[] = { int HTTPPrintCustom(httpd_req_t *req, char *buf, char *var) { char VarData[MAX_DYNVAR_LENGTH]; - const char incPat[] = "inc:"; - const int incPatLen = sizeof(incPat) - 1; - if (!memcmp(var, incPat, incPatLen)) - { - const char rootFS[] = "/"; - char filename[32]; - filename[0] = 0x00; - var += incPatLen; - strcat(filename, rootFS); - strcat(filename, var); - espfs_file_t *file = espfs_fopen(fs, filename); - struct espfs_stat_t stat; - if (file) - { - espfs_fstat(file, &stat); - int readBytes = espfs_fread(file, buf, stat.size); - espfs_fclose(file); - return readBytes; - } - } - bool fnd = false; char *p2 = var + strlen(var) - 1; //last var symbol int arg = 0; //searching for tag in handles array for (int i = 0; i < (sizeof(HANDLERS_ARRAY_CUST) / sizeof(HANDLERS_ARRAY_CUST[0])); ++i) { + //Try to extract integer parameter from dynamic variable if (*p2 == ')') { //found close brace char *p1 = p2; @@ -84,12 +58,13 @@ int HTTPPrintCustom(httpd_req_t *req, char *buf, char *var) --p1; if (*p1 == '(') { //found open brace - *p1 = 0x00; //trim variable to name part - ++p1; //to begin of argument - *p2 = 0x00; //set end of argument + *p1 = 0x00; //trim variable to name part + ++p1; //to begin of argument + *p2 = 0x00; //set end of argument arg = atoi(p1); } } + if (strcmp(var, HANDLERS_ARRAY_CUST[i].tag) == 0 && HANDLERS_ARRAY_CUST[i].HandlerRoutine != NULL) {