Browse Source

updated webpages

master
Ondřej Hruška 6 years ago
parent
commit
abf135da4e
  1. 3
      _web-build_do.sh
  2. 1088
      html/css/app.css
  3. 961
      html/js/all.js
  4. 6
      html/pages/home.tpl
  5. 41
      html/pages/wfm.html
  6. 5
      html/pages/wifi.tpl
  7. 25
      html_src/chart.php
  8. 1181
      html_src/css/app.css
  9. 12
      html_src/js-src/lib/chartist.js
  10. 7
      html_src/js-src/waveform.js
  11. 19
      html_src/js/all.js
  12. 2
      html_src/js/all.js.map
  13. 20
      html_src/waveform.php
  14. 2
      user/cgi.c
  15. 14
      user/routes.c
  16. 2
      web-build.sh

3
.web-build_do.sh → _web-build_do.sh

@ -11,7 +11,7 @@ rm -rf "$BLDDIR/js"
rm -rf "$BLDDIR/css"
cd "$SRCDIR"
gulp
gulp --production
cd ..
cp -R "$SRCDIR/css" "$BLDDIR"
@ -23,3 +23,4 @@ mkdir -p "$BLDDIR/pages"
php "$SRCDIR/home.php" > "$BLDDIR/pages/home.tpl"
php "$SRCDIR/wifi.php" > "$BLDDIR/pages/wifi.tpl"
php "$SRCDIR/waveform.php" > "$BLDDIR/pages/wfm.html" # no substitutions, .html allows to gzip it.

1088
html/css/app.css

File diff suppressed because one or more lines are too long

961
html/js/all.js

File diff suppressed because one or more lines are too long

6
html/pages/home.tpl

@ -16,7 +16,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current analyzer</div>
<a href="/" class="selected">Home</a><a href="/wifi">WiFi config</a><a href="/fft">FFT</a><a href="/spectrogram">Spectrogram</a><a href="/transient">Power-on transient</a><a href="/about">Credits &amp; About</a></nav>
<a href="/" class="selected">Home</a><a href="/wifi">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/spectrogram">Spectrogram</a><a href="/transient">Power-on transient</a><a href="/about">Credits &amp; About</a></nav>
<div id="content">
<h1>System Status</h1>
@ -89,13 +89,11 @@
$('#rssi-dbm').html(staRSSI);
}
// TODO use json + ajax instead
setTimeout(function(){location.reload()}, 10000);
});
</script>
<script>
$().ready(initDef);
</script>
</div>
</div>
</body>

41
html/pages/wfm.html

@ -0,0 +1,41 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Waveform - Current analyzer</title>
<link href="/css/app.css" rel="stylesheet">
<script src="/js/all.js"></script>
</head>
<body class="page-waveform">
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current analyzer</div>
<a href="/">Home</a><a href="/wifi">WiFi config</a><a href="/waveform" class="selected">Waveform</a><a href="/fft">FFT</a><a href="/spectrogram">Spectrogram</a><a href="/transient">Power-on transient</a><a href="/about">Credits &amp; About</a></nav>
<div id="content">
<h1>Waveform</h1>
<div class="Box center">
<label for="count">Samples:</label>
<input id="count" type="number" value="100" style="width:100px">&nbsp;
<a id="load" class="button btn-green">Load</a>
</div>
<div class="Box medium">
<div id="chart" class="ct-chart ct-wide"></div>
</div>
<script>
$().ready(wfm.init());
</script>
</div>
</div>
</body>
</html>

5
html/pages/wifi.tpl

@ -16,7 +16,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">Current analyzer</div>
<a href="/">Home</a><a href="/wifi" class="selected">WiFi config</a><a href="/fft">FFT</a><a href="/spectrogram">Spectrogram</a><a href="/transient">Power-on transient</a><a href="/about">Credits &amp; About</a></nav>
<a href="/">Home</a><a href="/wifi" class="selected">WiFi config</a><a href="/waveform">Waveform</a><a href="/fft">FFT</a><a href="/spectrogram">Spectrogram</a><a href="/transient">Power-on transient</a><a href="/about">Credits &amp; About</a></nav>
<div id="content">
<h1>Wireless Setup</h1>
@ -59,9 +59,6 @@
</div>
</div>
<script>
$().ready(initDef);
</script>
</div>
</div>
</body>

25
html_src/chart.php

File diff suppressed because one or more lines are too long

1181
html_src/css/app.css

File diff suppressed because one or more lines are too long

12
html_src/js-src/lib/chartist.js

@ -1513,7 +1513,7 @@ var Chartist = {
};
constr.prototype = proto;
constr.super = superProto;
constr['super'] = superProto;
constr.extend = this.extend;
return constr;
@ -2860,7 +2860,7 @@ var Chartist = {
max: this.bounds.max
};
Chartist.AutoScaleAxis.super.constructor.call(this,
Chartist.AutoScaleAxis['super'].constructor.call(this,
axisUnit,
chartRect,
this.bounds.values,
@ -2914,7 +2914,7 @@ var Chartist = {
max: highLow.high
};
Chartist.FixedScaleAxis.super.constructor.call(this,
Chartist.FixedScaleAxis['super'].constructor.call(this,
axisUnit,
chartRect,
this.ticks,
@ -2953,7 +2953,7 @@ var Chartist = {
'use strict';
function StepAxis(axisUnit, data, chartRect, options) {
Chartist.StepAxis.super.constructor.call(this,
Chartist.StepAxis['super'].constructor.call(this,
axisUnit,
chartRect,
options.ticks,
@ -3368,7 +3368,7 @@ var Chartist = {
*
*/
function Line(query, data, options, responsiveOptions) {
Chartist.Line.super.constructor.call(this,
Chartist.Line['super'].constructor.call(this,
query,
data,
defaultOptions,
@ -3798,7 +3798,7 @@ var Chartist = {
*
*/
function Bar(query, data, options, responsiveOptions) {
Chartist.Bar.super.constructor.call(this,
Chartist.Bar['super'].constructor.call(this,
query,
data,
defaultOptions,

7
html_src/js-src/waveform.js

@ -81,10 +81,15 @@ var wfm = (function () {
}
wfm.init = function() {
// var resp = {
// "samples": [1878, 1883, 1887, 1897, 1906, 1915, 1926, 1940, 1955, 1970, 1982, 1996, 2012, 2026, 2038, 2049],
// "success": true
// };
$('#load').on('click', function() {
var samples = $('#count').val();
$().get('http://192.168.1.13/api/raw.json?count='+samples, onRxData, true, true);
$().get('http://192.168.1.13/api/raw.json?n='+samples, onRxData, true, true);
});
};

19
html_src/js/all.js

@ -2220,7 +2220,7 @@ var Chartist = {
};
constr.prototype = proto;
constr.super = superProto;
constr['super'] = superProto;
constr.extend = this.extend;
return constr;
@ -3567,7 +3567,7 @@ var Chartist = {
max: this.bounds.max
};
Chartist.AutoScaleAxis.super.constructor.call(this,
Chartist.AutoScaleAxis['super'].constructor.call(this,
axisUnit,
chartRect,
this.bounds.values,
@ -3621,7 +3621,7 @@ var Chartist = {
max: highLow.high
};
Chartist.FixedScaleAxis.super.constructor.call(this,
Chartist.FixedScaleAxis['super'].constructor.call(this,
axisUnit,
chartRect,
this.ticks,
@ -3660,7 +3660,7 @@ var Chartist = {
'use strict';
function StepAxis(axisUnit, data, chartRect, options) {
Chartist.StepAxis.super.constructor.call(this,
Chartist.StepAxis['super'].constructor.call(this,
axisUnit,
chartRect,
options.ticks,
@ -4075,7 +4075,7 @@ var Chartist = {
*
*/
function Line(query, data, options, responsiveOptions) {
Chartist.Line.super.constructor.call(this,
Chartist.Line['super'].constructor.call(this,
query,
data,
defaultOptions,
@ -4505,7 +4505,7 @@ var Chartist = {
*
*/
function Bar(query, data, options, responsiveOptions) {
Chartist.Bar.super.constructor.call(this,
Chartist.Bar['super'].constructor.call(this,
query,
data,
defaultOptions,
@ -5269,10 +5269,15 @@ var wfm = (function () {
}
wfm.init = function() {
// var resp = {
// "samples": [1878, 1883, 1887, 1897, 1906, 1915, 1926, 1940, 1955, 1970, 1982, 1996, 2012, 2026, 2038, 2049],
// "success": true
// };
$('#load').on('click', function() {
var samples = $('#count').val();
$().get('http://192.168.1.13/api/raw.json?count='+samples, onRxData, true, true);
$().get('http://192.168.1.13/api/raw.json?n='+samples, onRxData, true, true);
});
};

2
html_src/js/all.js.map

File diff suppressed because one or more lines are too long

20
html_src/waveform.php

@ -0,0 +1,20 @@
<?php $page = 'waveform';
include "_start.php"; ?>
<h1>Waveform</h1>
<div class="Box center">
<label for="count">Samples:</label>
<input id="count" type="number" value="100" style="width:100px">&nbsp;
<a id="load" class="button btn-green">Load</a>
</div>
<div class="Box medium">
<div id="chart" class="ct-chart ct-wide"></div>
</div>
<script>
$().ready(wfm.init());
</script>
<?php include "_end.php"; ?>

2
user/cgi.c

@ -51,7 +51,7 @@ int FLASH_FN tplReadSamplesJSON(HttpdConnData *connData, char *token, void **arg
// check how many samples are requested
uint16_t count = 1;
int len = httpdFindArg(connData->getArgs, "count", buff20, sizeof(buff20));
int len = httpdFindArg(connData->getArgs, "n", buff20, sizeof(buff20));
if (len != -1) count = (uint16_t)atoi(buff20);
if (count > 4096) {
warn("Requested %d samples, capping at 4096.", count);

14
user/routes.c

@ -35,11 +35,12 @@ static int FLASH_FN myPassFn(HttpdConnData *connData, int no, char *user, int us
HttpdBuiltInUrl builtInUrls[] = {
ROUTE_CGI_ARG("*", cgiRedirectApClientToHostname, "esp8266.nonet"), // redirect func for the captive portal
ROUTE_TPL_FILE("/", tplHome, "/pages/home.tpl"),
// --- UI pages ---
// API for measurements
ROUTE_TPL_FILE("/api/raw.json", tplReadSamplesJSON, "/json/samples.tpl"),
ROUTE_TPL_FILE("/", tplHome, "/pages/home.tpl"),
ROUTE_FILE("/waveform", "/pages/wfm.html"), // static file
// --- WiFi config ---
#if WIFI_PROTECT
ROUTE_AUTH("/wifi/*", myPassFn),
@ -53,6 +54,13 @@ HttpdBuiltInUrl builtInUrls[] = {
ROUTE_CGI("/wifi/connstatus.cgi", cgiWiFiConnStatus),
ROUTE_CGI("/wifi/setmode.cgi", cgiWiFiSetMode),
// --- API ---
// API for measurements
ROUTE_TPL_FILE("/api/raw.json", tplReadSamplesJSON, "/json/samples.tpl"),
// --- FS ---
ROUTE_FS("*"), //Catch-all cgi function for the filesystem NOTE: unsafe, lets user read templates.
ROUTE_END()

2
web-build.sh

@ -1,3 +1,3 @@
#!/bin/bash
xterm -title "ESP html build" -e "source $HOME/.bashrc && ./.web-build_do.sh"
xterm -title "ESP html build" -e "source $HOME/.bashrc && ./_web-build_do.sh"

Loading…
Cancel
Save