Skip to content

Commit

Permalink
Version 1.2.1
Browse files Browse the repository at this point in the history
- Wifi config bug fixed (wrong file linked)
- Replaced WiFi.status() with wifi_station_get_connect_status() (WiFi.status() buggy??)
- Added simple system log to the debug page
- Code cleanup and formatting
  • Loading branch information
arjenhiemstra committed Jun 6, 2020
1 parent ade8f93 commit d0fba3b
Show file tree
Hide file tree
Showing 15 changed files with 628 additions and 406 deletions.
30 changes: 15 additions & 15 deletions software/NRG_itho_wifi/01_Statics.ino
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* Create gzipped combined css file in terminal:
*
* combine: pure-min.css + side-menu layout css + https://unpkg.com/purecss@1.0.1/build/grids-responsive-min.css + button extension + custom css >> gfile.css
* gzip gfile.css
* xxd -i -c 45 gfile.gz
*
* copy output in pure_min_css_gz[]
*
* button extension CSS:
.button-error,.button-secondary,.button-success,.button-warning{color:#fff}.button-success{background:#1cb841}.button-error{background:#ca3c3c}.button-warning{background:#df7514}.button-secondary{background:#42b8dd}
* custom CSS:
#main{margin-left:auto;margin-right:auto;padding-left:1em;padding-right:1em;max-width:768px}#svgSignalImage{position:relative;top:10px;left:5px}#svgSecImage{position:relative;top:12px;left:5px}#memory_box{position:fixed;display:none;z-index:1001;bottom:0;right:0;padding:10px}#message_box{position:fixed;top:0;z-index:1001;background:#eee;width:40%;display:none;padding:1px;text-align:center;font-weight:700;left:50%;margin-left:-20%}.messageP{background:#93d4ff;border-width:1px;border-color:#1f8dd6;border-style:solid;margin:3px;padding:3px;-webkit-animation:fadeinout 5s linear 1 forwards;animation:fadeinout 5s linear 1 forwards}@-webkit-keyframes fadeinout{0%{opacity:1}90%{opacity:1}100%{opacity:0}}@keyframes fadeinout{0%{opacity:1}90%{opacity:1}100%{opacity:0}}
*
*/
/*
Create gzipped combined css file in terminal:
combine: pure-min.css + side-menu layout css + https://unpkg.com/purecss@1.0.1/build/grids-responsive-min.css + button extension + custom css >> gfile.css
gzip gfile.css
xxd -i -c 45 gfile.gz
copy output in pure_min_css_gz[]
button extension CSS:
.button-error,.button-secondary,.button-success,.button-warning{color:#fff}.button-success{background:#1cb841}.button-error{background:#ca3c3c}.button-warning{background:#df7514}.button-secondary{background:#42b8dd}
custom CSS:
#main{margin-left:auto;margin-right:auto;padding-left:1em;padding-right:1em;max-width:768px}#svgSignalImage{position:relative;top:10px;left:5px}#svgSecImage{position:relative;top:12px;left:5px}#memory_box{position:fixed;display:none;z-index:1001;bottom:0;right:0;padding:10px}#message_box{position:fixed;top:0;z-index:1001;background:#eee;width:40%;display:none;padding:1px;text-align:center;font-weight:700;left:50%;margin-left:-20%}.messageP{background:#93d4ff;border-width:1px;border-color:#1f8dd6;border-style:solid;margin:3px;padding:3px;-webkit-animation:fadeinout 5s linear 1 forwards;animation:fadeinout 5s linear 1 forwards}@-webkit-keyframes fadeinout{0%{opacity:1}90%{opacity:1}100%{opacity:0}}@keyframes fadeinout{0%{opacity:1}90%{opacity:1}100%{opacity:0}}
*/



Expand Down
53 changes: 52 additions & 1 deletion software/NRG_itho_wifi/02_HTML.ino
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,58 @@ void handleDebug(AsyncWebServerRequest *request) {
response->print(FWVERSION);
response->print("<br><br>Config version: ");
response->print(CONFIG_VERSION);
response->print("</vid>");
response->print("<br><br></div>");
response->print("<div style='padding: 10px;background-color: black;background-image: radial-gradient(rgba(0, 150, 0, 0.55), black 140%);height: 60vh;} color: white; font: 0.9rem Inconsolata, monospace;border-radius: 10px;overflow:auto'>--- System Log ---<br>");
String link = "";
String linkcur = "";
if ( SPIFFS.exists("/logfile0.current.log") ) {
linkcur = "/logfile0.current.log";
link = "/logfile1.log";
}
else {
linkcur = "/logfile1.current.log";
link = "/logfile0.log";
}

File file = SPIFFS.open(linkcur, FILE_READ);
while (file.available()) {
//count row
//of more than x row display fom total - 1
response->print(char(file.read()));

}
file.close();

response->print("</div><br><br><a class='pure-button' href='/curlog'>Download current logfile</a>");


if ( SPIFFS.exists(link) ) {
response->print("&nbsp;<a class='pure-button' href='/prevlog'>Download previous logfile</a>");

}
response->print("<br><br>");

request->send(response);
}

void handleCurLogDownload(AsyncWebServerRequest *request) {
String link = "";
if ( SPIFFS.exists("/logfile0.current.log") ) {
link = "/logfile0.current.log";
}
else {
link = "/logfile1.current.log";
}
request->send(SPIFFS, link, String(), true);
}

void handlePrevLogDownload(AsyncWebServerRequest *request) {
String link = "";
if ( SPIFFS.exists("/logfile0.current.log") ) {
link = "/logfile1.log";
}
else {
link = "/logfile0.log";
}
request->send(SPIFFS, link, String(), true);
}
1 change: 0 additions & 1 deletion software/NRG_itho_wifi/03_CSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ void css_code(AsyncWebServerRequest *request) {
response->addHeader("Content-Encoding", "gzip");
request->send(response);
}

12 changes: 6 additions & 6 deletions software/NRG_itho_wifi/04_JS_UI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ void zepto_min_js_gz_code(AsyncWebServerRequest *request) {

void handleGeneralJs(AsyncWebServerRequest *request) {
AsyncResponseStream *response = request->beginResponseStream("application/javascript");
response->addHeader("Server","Project WiFi Web Server");
response->addHeader("Server", "Project WiFi Web Server");

response->print("var on_ap = false; var hostname = '");
response->print(EspHostname());
response->print("'; $(document).ready(function() { $('#headingindex').text(hostname); $('#headingindex').attr('href', 'http://' + hostname + '.local'); $('#main').append(html_index); });");

request->send(response);
}

void handleGeneralJsOnAp(AsyncWebServerRequest *request) {
AsyncResponseStream *response = request->beginResponseStream("application/javascript");
response->addHeader("Server","Project WiFi Web Server");
response->addHeader("Server", "Project WiFi Web Server");

response->print("var on_ap = true; var hostname = '");
response->print(EspHostname());
response->print("'; $(document).ready(function() { $('#headingindex').text(hostname); $('#headingindex').attr('href', 'http://' + hostname + '.local'); $('#main').append(html_wifisetup); });");

request->send(response);
}
Loading

0 comments on commit d0fba3b

Please sign in to comment.