initial commit of application

This commit is contained in:
Bogdan Pilyugin 2022-08-16 15:15:14 +02:00
parent ca0fc65e23
commit 34b2017dcd
19 changed files with 8845 additions and 89 deletions

17
.cproject Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="org.eclipse.cdt.core.default.config.1051207757">
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.1051207757" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
<externalSettings/>
<extensions/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path=""/>
<pathentry excluding="**/CMakeFiles/**" kind="out" path="build"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>

4722
.project Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

12
CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId})
# Include espfs ROM in foldef HTML
include(components/libespfs/cmake/include.cmake)
target_add_espfs(web-gui-application-test.elf espfs HTML)

7
HTML/espfs.paths Normal file
View File

@ -0,0 +1,7 @@
iconsfont.css
iconsfont.woff2
index.html
ioscr.js
logo.png
main.js
styles.css

63
HTML/iconsfont.css Normal file
View File

@ -0,0 +1,63 @@
@font-face {
font-family: 'iconsfont';
src: url('iconsfont.woff2') format('woff2');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'iconsfont';
src: url('../font/iconsfont.svg?14637405#iconsfont') format('svg');
}
}
*/
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "iconsfont";
font-style: normal;
font-weight: normal;
speak: never;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.icon-mail:before { content: '\e800'; } /* '' */
.icon-picture:before { content: '\e801'; } /* '' */
.icon-info-circled:before { content: '\e802'; } /* '' */
.icon-user:before { content: '\e805'; } /* '' */
.icon-wrench:before { content: '\e806'; } /* '' */
.icon-cog-alt:before { content: '\e807'; } /* '' */
.icon-chart-bar:before { content: '\e808'; } /* '' */
.icon-down-open:before { content: '\e809'; } /* '' */
.icon-home:before { content: '\e80a'; } /* '' */
.icon-menu:before { content: '\f0c9'; } /* '' */
.icon-sliders:before { content: '\f1de'; } /* '' */
.icon-wifi:before { content: '\f1eb'; } /* '' */

BIN
HTML/iconsfont.woff2 Normal file

Binary file not shown.

143
HTML/index.html Normal file
View File

@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="iconsfont.css">
<script src="ioscr.js"></script>
<title>Charge Point Type2</title>
</head>
<body>
<header class="header">
<div class="header__container">
<img src="logo.png" alt="" class="header__img">
<a href="#" class="header__logo">ChargeStation2</a>
<div class="header__toggle">
<i class='icon-menu' id="header-toggle"></i>
</div>
</div>
</header>
<div class="nav" id="navbar">
<nav class="nav__container">
<div>
<a href="#" class="nav__link nav__logo">
<i class='icon-home nav__icon' ></i>
<span class="nav__logo-name">Home</span>
</a>
<div class="nav__list">
<div class="nav__items">
<h3 class="nav__subtitle">ENERGY</h3>
<div class="nav__dropdown">
<a href="#" class="nav__link">
<i class='icon-chart-bar' ></i>
<span class="nav__name">Monitor</span>
<i class='icon-down-open nav__icon nav__dropdown-icon'></i>
</a>
<div class="nav__dropdown-collapse">
<div class="nav__dropdown-content">
<a href="#" class="nav__dropdown-item">Realtime</a>
<a href="#" class="nav__dropdown-item">History</a>
</div>
</div>
</div>
<div class="nav__dropdown">
<a href="#" class="nav__link">
<i class='icon-wrench nav__icon' ></i>
<span class="nav__name">Utilities</span>
<i class='icon-down-open nav__icon nav__dropdown-icon'></i>
</a>
<div class="nav__dropdown-collapse">
<div class="nav__dropdown-content">
<a href="#" class="nav__dropdown-item">Control</a>
<a href="#" class="nav__dropdown-item">Protection</a>
<a href="#" class="nav__dropdown-item">Logs</a>
</div>
</div>
</div>
</div>
<div class="nav__items">
<h3 class="nav__subtitle">SETTINGS</h3>
<div class="nav__dropdown">
<a href="#" class="nav__link">
<i class='icon-wifi nav__icon' ></i>
<span class="nav__name">Network</span>
<i class='icon-down-open nav__icon nav__dropdown-icon'></i>
</a>
<div class="nav__dropdown-collapse">
<div class="nav__dropdown-content">
<a href="#" class="nav__dropdown-item">Ethernet</a>
<a href="#" class="nav__dropdown-item">WiFi</a>
<a href="#" class="nav__dropdown-item">GPRS</a>
</div>
</div>
</div>
<div class="nav__dropdown">
<a href="#" class="nav__link">
<i class='icon-cog-alt nav__icon' ></i>
<span class="nav__name">Station</span>
<i class='icon-down-open nav__icon nav__dropdown-icon'></i>
</a>
<div class="nav__dropdown-collapse">
<div class="nav__dropdown-content">
<a href="#" class="nav__dropdown-item">General</a>
<a href="#" class="nav__dropdown-item">Services</a>
<a href="#" class="nav__dropdown-item">Time</a>
</div>
</div>
</div>
<a href="#" class="nav__link">
<i class='icon-user' ></i>
<span class="nav__name">Help</span>
</a>
</div>
</div>
</div>
<a href="#" class="nav__link nav__logout">
<i class='bx bx-log-out nav__icon' ></i>
<span class="nav__name">Log Out</span>
</a>
</nav>
</div>
<!--========== CONTENTS ==========-->
<main>
<section>
<div >
<table class='cntr'><tr>
<script>PrintCheckBox('Включить ETHERNET','ethen','~ethen~','configIPBoxes()');
PrintCheckBox('Включить DHCP','dhcp','~ecbdh~','configIPBoxes()');
PrintIPInput('IP Станции:','ipa','~eip~');
PrintIPInput('Маска подсети:','mas','~emsk~');
PrintIPInput(' Адрес шлюза:','gte','~egate~');
PrintIPInput('DNS1:','dns1','~edns~');
PrintIPInput('DNS2:','dns2','~bkedns~');
PrintIPInput('DNS3:','dns3','~fledns~');
PrintMACInput('MAC:','mac','~emacadr~');</script>
<tr><td></td></tr>
</table>
</div>
</section>
</main>
<!--========== MAIN JS ==========-->
<script src="main.js"></script>
</body>
</html>

491
HTML/ioscr.js Normal file
View File

@ -0,0 +1,491 @@
var Ku=1.0,Ki=0.02,sc=Ku*Ki/3600000;
var tds=['???','Пиковый','Полупиковый','Ночной'];
var tz=['+0','+1','+2','+3','+4','+5','+6','+7','+8','+9','+10','+11','+12','-12','-11','-10','-9','-8','-7','-6','-5','-4','-3','-2','-1'];
let trpend=[0,0,0];
function PostData(data,page,conf,alrt,reld) {
if(conf){if (!confirm(conf)) return;}
var xhr = new XMLHttpRequest();
xhr.open('POST',page, true);
xhr.timeout = 5000;
xhr.send(data);
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) return;
if (xhr.status != 200) {alert(xhr.status+': '+xhr.statusText);}
else {if(reld)location.reload();
if(alrt) alert(alrt);
}}}
function GetDataFile(file, callback) {
var xhr = new XMLHttpRequest();
xhr.overrideMimeType("application/json");
xhr.open("GET", file, true);
xhr.onreadystatechange = function() {if (xhr.readyState === 4 && xhr.status == "200") {callback(xhr.responseText);}}
xhr.timeout = 5000;
xhr.send(null);
}
function TimeToStr(t){
if(t>=(65535-1440))return '-----';
if(t>=1440) t-=1440;
return (Math.floor(t/60)).toString().padStart(2,'0')+':'+(Math.floor((t%60))).toString().padStart(2,'0'); }
function StrToTime(s){
return parseInt(s.substring(0,2))*60+parseInt(s.substring(3,5));}
function TimeToStrSec(t){
hh=Math.floor(t/3600).toString().padStart(2,'0');
mm=Math.floor((t-hh*3600)/60).toString().padStart(2,'0');
ss=Math.floor((t-hh*3600-mm*60)).toString().padStart(2,'0');
return hh+':'+mm+':'+ss;}
function StrToTimeSec(s){
return parseInt(s.substring(0,2))*3600+parseInt(s.substring(3,5))*60+parseInt(s.substring(6,8));}
function UnixToStr(t, z, base, sec) {
if(t.lenth < 10) t = '000000000';
var d;
if (base == 16) d = new Date((parseInt(t,16)+z)*1000);
else d=new Date((parseInt(t,10)+z)*1000);
var dd=d.getUTCDate();if(dd<10) dd='0'+dd;
var mm=d.getUTCMonth() + 1;if(mm<10) mm='0'+mm;
var yy=d.getUTCFullYear() % 100;if(yy<10) yy='0'+yy;
var h=d.getUTCHours();if(h<10) h='0'+h;
var m=d.getUTCMinutes();if(m<10) m='0'+m;
var s=d.getUTCSeconds();if(s<10) s='0'+s;
d=yy+'/'+mm+'/'+dd+' '+h+':'+m;
if(sec==1) d+=':'+s;
return d;}
function FloatToString(f) {
var buffer=new ArrayBuffer(4);
var bytes=new Uint8Array(buffer);
var doubles=new Float32Array(buffer);
bytes[3]='0x'+f.substr(6,2);
bytes[2]='0x'+f.substr(4,2);
bytes[1]='0x'+f.substr(2,2);
bytes[0]='0x'+f.substr(0,2);
return doubles[0];}
function SndTmr(z) {
body = ''; body2 = '';
for(i=1;i<9;++i){
body += GetInterface(i);
if(i<8) body +='&';}
for(i=9;i<17;++i){
body2 += GetInterface(i);
if(i<16) body2 +='&';}
function GetInterface(n) {
s='';
rawd=document.getElementById('tdp'+n).value;
date=Date.parse(rawd+':00Z')/1000-z;
s+='tm'+i+'='+date;
s+='%'+((document.getElementsByName('enb'+n)[0].checked)?'1':'0').toString();
s+='%'+document.getElementsByName('act'+n)[0].value;
s+='%'+document.getElementsByName('prd'+n)[0].value;
return s;}
var xhr2 = new XMLHttpRequest();
var xhr = new XMLHttpRequest();
xhr.open('POST','index42.html',true);
xhr.send(body);
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) return;
if (xhr.status != 200) {
alert(xhr.status + ': ' + xhr.statusText);
} else{
xhr2.open('POST','index42.html',true);
xhr2.send(body2);
}}
xhr2.onreadystatechange = function() {
if (xhr2.readyState != 4) return;
if (xhr2.status != 200) {
alert(xhr2.status + ': ' + xhr2.statusText);
} else {
alert('Параметры таймера сохранены')
location.reload();
}}
}
function clstmr(){PostData('tmr=rst','index42.html',false,'Таймеры очищены',true);}
function ClsTar(){PostData('tar=rst','index23_5.html',false,'Тарифы очищены',true);}
function ClickCheckbox(){
for(i=1;i<17;++i){
var st = !document.getElementsByName('enb'+i)[0].checked;
document.getElementById('tdp'+i).disabled = st;
document.getElementsByName('prd'+i)[0].disabled = st;
document.getElementsByName('act'+i)[0].disabled = st;
}}
function GenerateInterface(t, z){
timers = t;
document.write("<table>");
document.write("<tr><td></td><td>&nbsp;начало</td><td>&nbsp;повтор</td><td></td></tr>");
for(i=1;i<17;++i){
rep = ['once','1m','2m','5m','10m','15m','20m','30m','1h','2h','3h','6h','9h','12h','18h','1d','2d','7d'];
act=['Off','On','Rst','Wrs'];
tm=timers[i-1];
pos1=tm.indexOf("%",0);
dt=parseInt(tm.substring(0,pos1),16);
en=parseInt(tm.substr(pos1+1,2),16);
ac=parseInt(tm.substr(pos1+4,2),16);
rp=parseInt(tm.substr(pos1+7),16);
document.write("<div style='padding-top:0px;white-space:pre'>");
ch = (en != 0)?'checked':'';
document.write("<tr><td><input type='checkbox' name='enb"+i+"' "+ch+" onclick='ClickCheckbox()' ></td>");
date=new Date((dt+z*3600)*1000);
str=date.toISOString();
val=str.substring(0,16);
document.write("<td><input type='datetime-local' value='"+val+"' id='tdp"+i+"'></td>");
document.write("<td><select name='prd"+i+"'>");
for(ii=0;ii<18;++ii){
s=(ii==+rp)?"selected":"";
document.write("<option value='"+ii+"' "+s+" >"+rep[ii]+"</option>");}
document.write("</select></td>");
document.write("<td><select name='act"+i+"'>");
for(ii=0;ii<4;++ii){
s=(ii==+ac)?"selected":"";
document.write("<option value='"+ii+"' "+s+" >"+act[ii]+"</option>");}
document.write("</select></td></tr>");
document.write("</div>");}
document.write("</table>");}
function GenTarifTable(r){
document.write('<table>');
document.write("<tr><td></td><td>&nbsp;начало</td><td>&nbsp;конец</td><td>&nbsp;тариф</td></tr>");
for(i=1;i<7;++i){
var rc=(r[i-1]).split("%",4);
document.write("<div style='padding-top:0px;white-space:pre'>");
ch=(rc[0] != 0)?'checked':'';
document.write("<tr><td><input type='checkbox' id='tcb"+i+"' "+ch+"></td>");
document.write("<td class='tarw'><input type='time' id='tbgn"+i+"'"+"value='"+TimeToStr(parseInt(rc[1],10))+"' ></td>");
document.write("<td class='tarw'><input type='time' id='tend"+i+"'"+"value='"+TimeToStr(parseInt(rc[2],10))+"' ></td>");
document.write("<td><select id='sltar"+i+"'>");
for(ii=1; ii<4 ;++ii){
sel=(rc[3] == ii)?"selected":"";
document.write("<option "+sel+" value='"+ii+"'"+">"+tds[ii]+"</option>");}
document.write("</select></td></tr>");}
document.write("</table>");}
function SaveTar(){
var d="";
for(i=1;i<7;++i){
d+="tpr"+i+"=";
d+=((document.getElementById("tcb"+i).checked) ? "1":"0").toString()+"%";
d+=StrToTime(document.getElementById("tbgn"+i).value)+"%";
d+=StrToTime(document.getElementById("tend"+i).value)+"%";
d+=(document.getElementById("sltar"+i).value).toString()+"&";}
for(i=1;i<4;++i){
d+="tar"+i+"="+(document.getElementById("tar"+i).value).toString()+"&";}
d+="unt="+(document.getElementById("unt").value).toString()+"&sav=prs";
PostData(d,"index23_5.html",false,"Параметры тарифов сохранены",true);}
function ClsTar(){PostData('tarif=rst','index23_5.html',false,'Тарифы очищены',true);}
function SendSimpTim(btn){
ts=StrToTimeSec(document.getElementById("stbgn"+btn).value);
ac=document.getElementById("slact"+btn).value;
bt=document.getElementById("simt"+btn);st=bt.value;
if(st=="1"){st="0";bt.innerHTML="Пуск";bt.style.backgroundColor="#FF6633";bt.value="0";}
else {st="1";bt.innerHTML="Стоп";bt.style.backgroundColor="#99CC00";bt.value="1";}
d='tim'+btn+"="+ts+"&act"+btn+"="+ac+"&st"+btn+"="+st+"&sav=prs";
PostData(d,"index42_2.html",false,"",false);}
function GenSimpTimers(r){
document.write("<table style='margin-left:40px'>");
for(i=1;i<4;++i){rc=(r[i-1]).split("%",3);
t=TimeToStrSec(parseInt(rc[0],10));
document.write("<tr style='margin-top:40px'><td>Таймер "+i+"</td></tr>");
document.write("<tr><td class='stimr'><input type='time' id='stbgn"+i+"'"+" value='"+t+"' step='1'></td>");
document.write("<td><select id='slact"+i+"'>");s1="",s2="";
if(rc[1]==1)s1="selected";else s2="selected";
document.write("<option "+s1+" value='1'>On</option>");
document.write("<option "+s2+" value='0'>Off</option></select></td>");
if(rc[2]==1) document.write("<td><button type='submit' class='btn sbtn' id='simt"+i+"' value='1' onclick='SendSimpTim("+i+")'>Стоп</button></td></tr>");
else document.write("<td><button type='submit' class='btn sbtn timact' id='simt"+i+"' value='0' onclick='SendSimpTim("+i+")'>Пуск</button></td></tr>");}
document.write("</table>");}
function RefSimpTimers(){
function refresh(){
if (this.status == 200) {
r=JSON.parse(this.responseText);
for(i=1;i<4;++i){
var rc=(r.tmr2[i-1]).split("%",3);
tt=parseInt(rc[0],10);t=TimeToStrSec(tt);
if(rc[2]=="1" || trpend[i-1]==1){
document.getElementById("stbgn"+i).value=t;
document.getElementById("slact"+i).value=rc[1];
bt=document.getElementById("simt"+i);
if(rc[2]=="1"){bt.innerHTML="Стоп";bt.style.backgroundColor="#99CC00";}
else{bt.innerHTML="Пуск";bt.style.backgroundColor="#FF6633";}
if(tt<5&&tt!=0&&rc[2]=="1") trpend[i-1]=1;
else trpend[i-1]=0;
}}}};
var xhr=new XMLHttpRequest();
xhr.onload = refresh;
xhr.open('GET','/tmr2.json',true);
xhr.send();
}
function GenCntInter(N,curN,pp,tt,unt,tw,tz,ttr){
var T=parseFloat(ttr),P=0;
document.write("<table><tr><td align='right'>Счетчик:</td><td align='left'>№"+N+"</td></tr>");
document.write("<tr><td align='right'>Начало учета:</td><td align='left'><span id='tt"+N+"'>?</span></td></tr>");
document.write("<tr><td align='right'>Конец учета:</td><td align='left'><span name='tnow'>?</span></td></tr>");
document.write("<tr><td align='right'>Действующий тариф:</td><td align='left'><span id='curt'>?</span></td></tr>");
document.write("<tr><td height='20px'></td></tr>");
document.write("<tr class='acc'><td align='right'>Тариф:</td><td align='left'>Пиковый</td></tr>");
document.write("<tr class='acc'><td align='right'>Потребление:</td><td align='left'><span id='pp"+N+"1'>?</span> кВт*ч</td></tr>");
document.write("<tr class='acc'><td align='right'>Стоимость:</td><td align='left'><span id='prs"+N+"1'>?</span></td></tr><tr><td height='20px'></td></tr>");
document.write("<tr class='yl'><td align='right'>Тариф:</td><td align='left'>Полупиковый</td></tr>");
document.write("<tr class='yl'><td align='right'>Потребление:</td><td align='left'><span id='pp"+N+"2'>?</span> кВт*ч</td></tr>");
document.write("<tr class='yl'><td align='right'>Стоимость:</td><td align='left'><span id='prs"+N+"2'>?</span></td></tr><tr><td height='20px'></td></tr>");
document.write("<tr class='pri'><td align='right'>Тариф:</td><td align='left'>Ночной</td></tr>");
document.write("<tr class='pri'><td align='right'>Потребление:</td><td align='left'><span id='pp"+N+"3'>?</span> кВт*ч</td></tr>");
document.write("<tr class='pri'><td align='right'>Стоимость:</td><td align='left'><span id='prs"+N+"3'>?</span></td></tr><tr><td height='20px'></td></tr>");
document.write("<div class='ctrb'>");
document.write("<tr><td align='right'>Общее потребление:</td><td align='left'><span id='pp"+N+"'>?</span> кВт*ч</td></tr>");
document.write("<tr><td align='right'>Общая стоимость:</td><td align='left'><span id='prs"+N+"'>?</span></tr>");
document.write("</div><tr><td height='20px'></td></tr></table>");
document.getElementById('curt').innerHTML=tds[curN];
for(i=1;i<4;++i){
var px = FloatToString(pp[i])*sc;
document.getElementById("pp"+N+i).innerHTML=parseFloat(px).toFixed(4);
document.getElementById("prs"+N+i).innerHTML=(px*T).toFixed(2)+' '+unt;
P+=px;}
document.getElementById("pp"+N).innerHTML=parseFloat(P).toFixed(4);
document.getElementById("tt"+N).innerHTML=UnixToStr(tt,tz,10);
document.getElementById("prs"+N).innerHTML=(P*T).toFixed(2)+' '+unt;
document.getElementsByName('tnow')[0].innerHTML=UnixToStr(tw,tz,10);}
function configIPBoxes(){e=document.forms.conf;
var ap=document.getElementsByName('netm');
st=e.dhcp.checked;
function apmode(m){e.wfiap.disabled=m;e.wfpap.disabled=m;e.ipaap.disabled=m;}
function clnmode(m){e.wfi.disabled=m;e.wfp.disabled=m;e.ipa.disabled=m;e.mas.disabled=m;e.gte.disabled=m;}
if(ap[0].checked){apmode(true);clnmode(false);
e.ipa.disabled=st;e.mas.disabled=st;e.gte.disabled=st;}
if(ap[1].checked){apmode(false);clnmode(true);}
}
function sendtime() {var ut=Date.parse(new Date( Date.parse(document.getElementById('curdt').value)))/1000;
var d='timenow='+ut;
PostData(d,'index23_3.html',false,'Время установлено',false);}
function WriteChart(log,z){
var val=[],tst=[],vf=[],scl;
for(i=0;i<32;++i){
var r=log[i];
var t=r.substr(0,8);
if (t!='00000000') tst[i]=UnixToStr(t,z,16,0);
else tst[i]=0;
val[i]=FloatToString(r.substr(8,8));
vf[i]=parseFloat((val[i]*sc).toFixed(4));}
scl=Math.max.apply(null, vf);
document.write("<div class='wnd'><table><div class='wd'>");
document.write("<tr><td>дата&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;время&nbsp;кВт*ч</td><td></td></tr></div>");
for(i=0;i<32;++i){
document.write("<tr><td><div class='wd'>");
if(tst[i]!=0) document.write(tst[i]+" "+(val[i]*sc).toFixed(4));
else document.write("--/--/-- --:-- -----");
document.write("</div></td><td><div class='chart'>");
if(tst[i]!=0)document.write("<div style='width:"+Math.floor(160*0.95/(scl+sc)*((val[i]*sc).toFixed(4)))+"px;'></div>");
document.write("</div></td></tr>");}
document.write("</table></div>");}
function setprm(p) {
document.getElementById("vmin").value=Math.round(p[0]*Ku);
document.getElementById("vmax").value=Math.round(p[1]*Ku);
document.getElementById("imin").value=(p[2]*Ki).toFixed(1);
document.getElementById("imax").value=(p[3]*Ki).toFixed(1);}
function sld(){document.getElementById("vn").innerHTML=document.getElementById("vmin").value+' В';
document.getElementById("vx").innerHTML=document.getElementById("vmax").value+' В';
document.getElementById("in").innerHTML=document.getElementById("imin").value+' A';
document.getElementById("ix").innerHTML=document.getElementById("imax").value+' A';}
function sendprm(){var d='umin='+Math.round( parseFloat(document.getElementById("vmin").value,10)/Ku);
d+='&umax='+Math.round( parseFloat(document.getElementById("vmax").value,10)/Ku);
d+='&imin='+Math.round( parseFloat(document.getElementById("imin").value,10)/Ki);
d+='&imax='+Math.round( parseFloat(document.getElementById("imax").value,10)/Ki);
d+='&pten='+((document.getElementsByName('pten')[0].checked) ? '1':'0').toString();
d+='&rstt='+document.getElementById('rstt').value;
d+='&rstn='+document.getElementById('rstn').value;
d+='&sav=prs';
PostData(d,'index41.html',false,'Параметры установлены',true);}
function GenTzSel(zn) {
document.write('<tr><td class=\'rl\'>Time zone:</td><td><select size="1" name = "tz" id="tz">');
for(i=0;i<=24;++i) document.write('<option value='+i+'>GMT'+tz[i]+'</option>');
document.write('</select></td></tr>');
document.getElementById('tz').value = zn;}
function PrintIPInput(title,name,value){document.write("<tr><td class='rl'>"+title+"</td><td><input type='text' required size='20' name='"+name+"' value='"+value+"' title='IP адрес xxx.xxx.xxx.xxx' pattern='^\\d{1,3}\.\\d{1,3}\.\\d{1,3}\.\\d{1,3}$' /></td></tr>");}
function PrintMACInput(title,name,value){document.write("<tr><td class='rl'>MAC:</td><td><input type='text' required size='20' name='"+name+"' value='"+value+"' title='MAC адрес xx-xx-xx-xx-xx-xx' pattern='^([0-9a-fA-F]{2}([-]|$)){6}$|([0-9a-fA-F]{4}([.]|$)){3}$' /></td></tr>");}
function PrintTextInput(title,name,value,min,max){document.write("<tr><td class='rl'>"+title+"</td><td><input type='text' required size='20' name='"+name+"' value="+value+" title='"+min+"-"+max+" символов A-Za-z0-9_\-*!<>)(.@,/' pattern='^[0-9a-zA-Z_\\-*!<>.@\,/)(\s]{"+min+","+max+"}$' /></td></tr>");}
function PrintTextInputNoReg(title,name,value,min,max){document.write("<tr><td class='rl'>"+title+"</td><td><input type='text' required size='20' name='"+name+"' value="+value+" title='"+min+"-"+max+" символов'/></td></tr>");}
function PrintLabel(title,value){document.write("<tr><td class='rl'>"+title+"</td><td align='left'>"+value+"</td></tr>");}
function PrintCheckBox(title,name,checked,action){document.write("<tr><td class='rl'>"+title+"</td><td><input type='checkbox' name='"+name+"' value='1' onclick="+action+" "+checked+" /></td></tr>");}
function PrintInt(title,name,value,min,max){document.write("<tr><td class='rl'>"+title+"</td><td><input type='number' required min='"+min+"' max='"+max+"' name='"+name+"' value ='"+value+"'/></td></tr>");}
function PrintIntId(title,id,value,min,max){document.write("<tr><td class='rl'>"+title+"</td><td><input type='number' required min='"+min+"' max='"+max+"' id='"+id+"' value ='"+value+"'/></td></tr>");}
function PrintSep(){document.write("<tr><td height='20px'></td></tr>");}
function PrintTar(title,name,value){document.write("<tr><td class='rl'>"+title+"</td><td><input type='text' required value='"+value+"' size='6' id='"+name+"' title='число 3-6 символов с десятичной точкой' pattern='[0-9\.]{3,6}'/></td></tr>");}
function PrintSaveBtn(){document.write("<div style='text-align:center;margin-top:10px'><button type='submit' class='btn' name='sav' value='prs'>Сохранить</button></div>");}
function PrintSaveFail(isfail){document.write("<div class='resfail' style='text-align:center;display:"+isfail+"' color='#F00'><font color='red'><h2>Ошибка формата данных!</h2></font><br/></div>");}
function PrintMenu(){
document.write("<div id='conteiner'><nav id='menu1'><ul>");
document.write("<li><a href='index.html'>Главная</a></li>");
document.write("<li><a href='#'>Измерения</a><ul>");
document.write("<li><a href='index31.html'>Счетчик1</a></li>");
document.write("<li><a href='index31_5.html'>Счетчик2</a></li>");
document.write("<li><a href='index32.html'>5 минут</a></li>");
document.write("<li><a href='index33.html'>1 час</a></li>");
document.write("<li><a href='index34.html'>1 день</a></li></ul></li>");
document.write("<li><a href='#'>Контроль</a><ul>");
document.write("<li><a href='index41.html'>Защита</a></li>");
document.write("<li><a href='index42.html'>Менеджер</a></li>");
document.write("<li><a href='index42_2.html'>Таймер</a></li>");
document.write("<li><a href='index43.html'>Астрореле</a></li>");
document.write("<li><a href='index44.html'>ПингТаймер</a></li></ul></li>");
document.write("<li><a href ='#'>Настройки</a><ul>");
document.write("<li><a href='index21.html'>Сеть</a></li>");
document.write("<li><a href='index22.html'>MQTT</a></li>");
document.write("<li><a href='index23.html'>Система</a></li>");
document.write("<li><a href='index23_3.html'>Время</a></li>");
document.write("<li><a href='index23_5.html'>Тарифы</a></li>");
document.write("<li><a href='index24.html'>Журнал</a></li></ul></li>");
document.write("</ul></nav></div>");}
function saveFile(fileName,urlFile){
let a = document.createElement("a");
a.style = "display: none";
document.body.appendChild(a);
a.href = urlFile;
var D = new Date();
a.download ='WS10_'+fileName+'_'+((D).toISOString()).substr(0,19)+'.dat';
a.click();
window.URL.revokeObjectURL(urlFile);
a.remove();
}
function ReadEEPR(v5m,v1h,v1d,z){
document.getElementById('tmr').innerHTML=0;
var str=document.location.toString();
var ref=str.substring(0,str.lastIndexOf('/savehist.html'));
let data = {bufm:[],bufh:[],bufd:[],adr:0x1006,isReady:true};
function PrcdData(){
function Iter(item){
if(item.substr(0,8)!='00000000')
prnt+=UnixToStr(item.substr(0,8),z,16,0)+' '+(FloatToString(item.substr(8,8))*sc).toFixed(4)+' кВт*ч\r\n'}
data.bufm.sort();data.bufh.sort();data.bufd.sort();
var prnt='5 минут\r\n';data.bufm.forEach(Iter);
prnt+='1 час\r\n';data.bufh.forEach(Iter);
prnt+='1 день\r\n';data.bufd.forEach(Iter);
let blobData = new Blob([prnt], {type: "text/plain"});
let url = window.URL.createObjectURL(blobData);
saveFile('measures',url);
window.location=ref+'/index23.html';
}
function ReadChunk(){
if (this.readyState==4 && this.status==200) {
for(i=0;i<8;++i){
r=(this.response.mem[i]).substr(5,32);
r1=r.substr(6,2)+r.substr(4,2)+r.substr(2,2)+r.substr(0,2)+r.substr(8,8);
r2=r.substr(22,2)+r.substr(20,2)+r.substr(18,2)+r.substr(16,2)+r.substr(24,8);
if(data.adr<0x1906){data.bufm.push(r1);data.bufm.push(r2);}
else if (data.adr<0x1f06){data.bufh.push(r1);data.bufh.push(r2);}
else{data.bufd.push(r1);data.bufd.push(r2);}}
data.adr+=0x80;data.isReady=true;
document.getElementById('tmr').innerHTML=Math.round((data.adr-0x1006)/(0x2B06-0x1006)*100);
if(data.adr==0x2B06) {clearInterval(timerId);
PrcdData();
}}else{alert(xhr.status+': '+xhr.statusText);window.location=ref+'/index23.html'}}
let timerId = setInterval(function(){
if(data.isReady){
data.isReady=false;
var xhr=new XMLHttpRequest();
xhr.open('POST',ref+'/mem.json', true);
xhr.responseType='json';
xhr.onreadystatechange=ReadChunk;
xhr.send('base='+data.adr.toString(16));}},5);
}
function ReadConf(){
document.getElementById('tmr').innerHTML=0;
var str=document.location.toString();
var ref=str.substring(0,str.lastIndexOf('/saveconf.html'));
let data = {buf:[],adr:0x0000,isReady:true};
function PrcdData(){
function Iter(item){prnt+=item+'\r\n';}
var prnt='';data.buf.forEach(Iter);
let blobData = new Blob([prnt], {type: "text/plain"});
let url = window.URL.createObjectURL(blobData);
saveFile('config',url);
window.location=ref+'/index23.html';
}
function ReadChunk(){
if (this.readyState==4 && this.status==200) {
for(i=0;i<8;++i){
r=(this.response.mem[i]).substr(5,32);
data.buf.push(r);}
data.adr+=0x80;data.isReady=true;
document.getElementById('tmr').innerHTML=Math.round((data.adr-0x0000)/(0x0800-0x0000)*100);
if(data.adr==0x0800) {clearInterval(timerId);
PrcdData();
}}else{alert(xhr.status+': '+xhr.statusText);window.location=ref+'/index23.html'}}
let timerId = setInterval(function(){
if(data.isReady){
data.isReady=false;
var xhr=new XMLHttpRequest();
xhr.open('POST',ref+'/mem.json', true);
xhr.responseType='json';
xhr.onreadystatechange=ReadChunk;
xhr.send('base='+data.adr.toString(16));}},5);
}
function WriteConf(input){
document.getElementById('tmr').innerHTML=0;
var str=document.location.toString();
var ref=str.substring(0,str.lastIndexOf('/restconf.html'));
let data = {buf:[],adr:0x0000,isReady:true};
let file = input.files[0];
let reader = new FileReader();
reader.readAsText(file);
reader.onload = function() {
data.buf = reader.result.split('\r\n');
function ReadChunk(){
if (this.readyState==4 && this.status==200) {
data.adr+=0x40;data.isReady=true;
document.getElementById('tmr').innerHTML=Math.round((data.adr-0x0000)/(0x0800-0x0000)*100);
if(data.adr==0x0800) {
clearInterval(timerId);
window.location=ref+'/reboot.html';
}}else{alert(xhr.status+': '+xhr.statusText);window.location=ref+'/index23.html'}}
let timerId = setInterval(function(){
if(data.isReady){
data.isReady=false;
var ind=data.adr/0x10;
var dt='write='+data.adr.toString(16);
dt+='&dt1='+data.buf[ind];
dt+='&dt2='+data.buf[ind+1];
dt+='&dt3='+data.buf[ind+2];
dt+='&dt4='+data.buf[ind+3];
var xhr=new XMLHttpRequest();
xhr.open('POST',ref+'/mem.json', true);
xhr.responseType='json';
xhr.onreadystatechange=ReadChunk;
xhr.send(dt);}},5);
};
reader.onerror = function() {};
}

BIN
HTML/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

27
HTML/main.js Normal file
View File

@ -0,0 +1,27 @@
/*==================== SHOW NAVBAR ====================*/
const showMenu = (headerToggle, navbarId) =>{
const toggleBtn = document.getElementById(headerToggle),
nav = document.getElementById(navbarId)
// Validate that variables exist
if(headerToggle && navbarId){
toggleBtn.addEventListener('click', ()=>{
// We add the show-menu class to the div tag with the nav__menu class
nav.classList.toggle('show-menu')
// change icon
toggleBtn.classList.toggle('bx-x')
})
}
}
showMenu('header-toggle','navbar')
/*==================== LINK ACTIVE ====================*/
const linkColor = document.querySelectorAll('.nav__link')
function colorLink(){
linkColor.forEach(l => l.classList.remove('active'))
this.classList.add('active')
}
linkColor.forEach(l => l.addEventListener('click', colorLink))

342
HTML/styles.css Normal file
View File

@ -0,0 +1,342 @@
/*========== GOOGLE FONTS ==========*/
/*========== VARIABLES CSS ==========*/
:root {
--header-height: 3.5rem;
--nav-width: 200px;
/*========== Colors ==========*/
--first-color: #FFFFFF;
--first-color-light: #ABEBC6 ;
--title-color: #ABEBC6;
--text-color: #444444;
--text-color-light: #ABEBC6;
--body-color: #FFFFFF;
--container-color: #28B463;
/*========== Font and typography ==========*/
--body-font: 'Arial', sanf-serif;
--large-font-size: 2.0rem;
--normal-font-size: 1.0rem;
--small-font-size: .75rem;
--smaller-font-size: .75rem;
/*========== Font weight ==========*/
--font-medium: 500;
--font-semi-bold: 600;
/*========== z index ==========*/
--z-fixed: 100;
}
@media screen and (min-width: 1024px) {
:root {
--normal-font-size: 1rem;
--small-font-size: .875rem;
--smaller-font-size: .813rem;
}
}
/*========== BASE ==========*/
*, ::before, ::after {
box-sizing: border-box;
}
body {
margin: var(--header-height) 0 0 0;
padding: 1rem 1rem 0;
font-family: var(--body-font);
font-size: var(--normal-font-size);
background-color: var(--body-color);
color: var(--text-color);
}
h3 {
margin: 0;
}
a {
text-decoration: none;
}
img {
max-width: 100%;
height: auto;
}
/*========== HEADER ==========*/
.header {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: var(--container-color);
box-shadow: 0 1px 0 rgba(22, 8, 43, 0.1);
padding: 0 1rem;
z-index: var(--z-fixed);
}
.header__container {
display: flex;
align-items: center;
height: var(--header-height);
justify-content: space-between;
}
.header__img {
width: 50px;
height: ;
border-radius: 5%;
}
.header__logo {
color: var(--title-color);
font-weight: var(--font-medium);
font-size: var(--large-font-size);
margin-left: 150px;
display: none;
}
.header__search {
display: flex;
padding: .40rem .75rem;
background-color: var(--first-color-light);
border-radius: .25rem;
}
.header__input {
width: 100%;
border: none;
outline: none;
background-color: var(--first-color-light);
}
.header__input::placeholder {
font-family: var(--body-font);
color: var(--text-color);
}
.header__icon,
.header__toggle {
font-size: 1.2rem;
}
.header__toggle {
color: var(--title-color);
cursor: pointer;
}
/*========== NAV ==========*/
.nav {
position: fixed;
top: 0;
left: -100%;
height: 100vh;
padding: 1rem 1rem 0;
background-color: var(--container-color);
box-shadow: 1px 0 0 rgba(22, 8, 43, 0.1);
z-index: var(--z-fixed);
transition: .4s;
}
.nav__container {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding-bottom: 3rem;
overflow: auto;
scrollbar-width: none; /* For mozilla */
}
/* For Google Chrome and others */
.nav__container::-webkit-scrollbar {
display: none;
}
.nav__logo {
font-weight: var(--font-semi-bold);
margin-bottom: 2.5rem;
}
.nav__list,
.nav__items {
display: grid;
}
.nav__list {
row-gap: 2.5rem;
}
.nav__items {
row-gap: 1.5rem;
}
.nav__subtitle {
font-size: var(--normal-font-size);
text-transform: uppercase;
letter-spacing: .1rem;
color: var(--text-color-light);
}
.nav__link {
display: flex;
align-items: center;
color: var(--text-color);
}
.nav__link:hover {
color: var(--first-color);
}
.nav__icon {
font-size: 1.2rem;
margin-right: .5rem;
}
.nav__name {
font-size: var(--small-font-size);
font-weight: var(--font-medium);
white-space: nowrap;
}
.nav__logout {
margin-top: 5rem;
}
/* Dropdown */
.nav__dropdown {
overflow: hidden;
max-height: 21px;
transition: .4s ease-in-out;
}
.nav__dropdown-collapse {
background-color: var(--first-color-light);
border-radius: .25rem;
margin-top: 1rem;
}
.nav__dropdown-content {
display: grid;
row-gap: .5rem;
padding: .75rem 2.5rem .75rem 1.8rem;
}
.nav__dropdown-item {
font-size: var(--smaller-font-size);
font-weight: var(--font-medium);
color: var(--text-color);
}
.nav__dropdown-item:hover {
color: var(--first-color);
}
.nav__dropdown-icon {
margin-left: auto;
transition: .4s;
}
/* Show dropdown collapse */
.nav__dropdown:hover {
max-height: 100rem;
}
/* Rotate icon arrow */
.nav__dropdown:hover .nav__dropdown-icon {
transform: rotate(180deg);
}
/*===== Show menu =====*/
.show-menu {
left: 0;
}
/*===== Active link =====*/
.active {
color: var(--first-color);
}
/* ========== MEDIA QUERIES ==========*/
/* For small devices reduce search*/
@media screen and (max-width: 320px) {
.header__search {
width: 70%;
}
}
@media screen and (min-width: 768px) {
body {
padding: 1rem 3rem 0 6rem;
}
.header {
padding: 0 3rem 0 6rem;
}
.header__container {
height: calc(var(--header-height) + .5rem);
}
.header__search {
width: 300px;
padding: .55rem .75rem;
}
.header__toggle {
display: none;
}
.header__logo {
display: block;
}
.header__img {
width: 40px;
height: 40px;
order: 1;
}
.nav {
left: 0;
padding: 1.2rem 1.5rem 0;
width: 68px; /* Reduced navbar */
}
.nav__items {
row-gap: 1.7rem;
}
.nav__icon {
font-size: 1.0rem;
}
/* Element opacity */
.nav__logo-name,
.nav__name,
.nav__subtitle,
.nav__dropdown-icon {
opacity: 0;
transition: .3s;
}
/* Navbar expanded */
.nav:hover {
width: var(--nav-width);
}
/* Visible elements */
.nav:hover .nav__logo-name {
opacity: 1;
}
.nav:hover .nav__subtitle {
opacity: 1;
}
.nav:hover .nav__name {
opacity: 1;
}
.nav:hover .nav__dropdown-icon {
opacity: 1;
}
}
.cntr { margin-left: 150px;
margin-right: auto;
color:#000;
font:14px consolas,monospace;}

5
LICENSE Normal file
View File

@ -0,0 +1,5 @@
Code in this repository is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.

View File

@ -1,92 +1,11 @@
# WebGUIApp
ESP-IDF template app
====================
This is a template application to be used with [Espressif IoT Development Framework](https://github.com/espressif/esp-idf).
Please check [ESP-IDF docs](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for getting started instructions.
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.com/userbogd/WebGUIApp.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.com/userbogd/WebGUIApp/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
*Code in this repository is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.*

10
main/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
# See the build system documentation in IDF programming guide
# for more information about component CMakeLists.txt files.
idf_component_register(
SRCS main.c # list the source files of this component
INCLUDE_DIRS # optional, add here public include directories
PRIV_INCLUDE_DIRS # optional, add here private include directories
REQUIRES # optional, list the public requirements (component names)
PRIV_REQUIRES # optional, list the private requirements
)

14
main/Kconfig.projbuild Normal file
View File

@ -0,0 +1,14 @@
# put here your custom config value
menu "Example Configuration"
config ESP_WIFI_SSID
string "WiFi SSID"
default "myssid"
help
SSID (network name) for the example to connect to.
config ESP_WIFI_PASSWORD
string "WiFi Password"
default "mypassword"
help
WiFi password (WPA or WPA2) for the example to use.
endmenu

56
main/main.c Normal file
View File

@ -0,0 +1,56 @@
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include "freertos/FreeRTOS.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "nvs_flash.h"
#include "esp_system.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#include "SystemConfiguration.h"
#include "romfs.h"
#include "NetTransport.h"
#include "HTTPServer.h"
#define MANUAL_RESET 0
void app_main(void)
{
esp_err_t err = nvs_flash_init();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND || MANUAL_RESET == 1)
{
// 1.OTA app partition table has a smaller NVS partition size than the non-OTA
// partition table. This size mismatch may cause NVS initialization to fail.
// 2.NVS partition contains data in new format and cannot be recognized by this version of code.
// If this happens, we erase NVS partition and initialize NVS again.
ESP_ERROR_CHECK(nvs_flash_erase());
ESP_ERROR_CHECK(nvs_flash_init());
ESP_ERROR_CHECK(ResetInitSysConfig());
}
ESP_ERROR_CHECK(InitSysConfig());
//init rom file system
init_rom_fs("/espfs");
#ifdef CONFIG_WEBGUIAPP_WIFI_ENABLE
/*Start WiFi connection*/
if (GetSysConf()->wifiSettings.Flags1.bIsWiFiEnabled)
{
if (GetSysConf()->wifiSettings.Flags1.bIsAP)
WiFiAPStart();
else
WiFiSTAStart();
}
#endif
ESP_ERROR_CHECK(start_file_server());
while (true) {
printf("Hello from app_main!\n");
sleep(1);
}
}

1463
sdkconfig Normal file

File diff suppressed because it is too large Load Diff

1463
sdkconfig.old Normal file

File diff suppressed because it is too large Load Diff