Browse Source

chart improvements

master
Ondřej Hruška 6 years ago
parent
commit
23681c9a0f
  1. 3
      build.sh
  2. 2
      esp_meas.pro.user
  3. 2
      html/css/app.css
  4. 2
      html/js/all.js
  5. 2
      html_src/css/app.css
  6. 2
      html_src/css/app.css.map
  7. 2
      html_src/gulpfile.js
  8. 15
      html_src/js-src/waveform.js
  9. 5289
      html_src/js/all.js
  10. 2
      html_src/js/all.js.map
  11. 3
      html_src/sass/app.scss
  12. 1
      html_src/sass/lib/chartist/_chartist.scss
  13. 35
      libesphttpd/core/httpd.c
  14. 2
      libesphttpd/html-minifier-conf.json
  15. 3
      web-gbuild.sh
  16. 2
      web-gwatch.sh

3
build.sh

@ -0,0 +1,3 @@
#!/bin/bash
xterm -title "ESP html build" -e "source $HOME/.bashrc && make -B -j4"

2
esp_meas.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.6.0, 2016-03-27T01:16:02. -->
<!-- Written by QtCreator 3.6.0, 2016-03-28T04:35:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

2
html/css/app.css

File diff suppressed because one or more lines are too long

2
html/js/all.js

File diff suppressed because one or more lines are too long

2
html_src/css/app.css

File diff suppressed because one or more lines are too long

2
html_src/css/app.css.map

File diff suppressed because one or more lines are too long

2
html_src/gulpfile.js

@ -3,6 +3,8 @@ var autoprefixer = require('autoprefixer');
elixir.config.css.autoprefix.options.browsers = ["> 2.5% in CZ"];
elixir.config.css.autoprefix.options.flexbox = "no-2009";
elixir.config.css.cssnano.pluginOptions.discardComments = {removeAll: true};
elixir.config.css.cssnano.pluginOptions.colormin = false;
// var info = autoprefixer(elixir.config.css.autoprefix).info();
// console.log(info);

15
html_src/js-src/waveform.js

@ -77,7 +77,7 @@ var wfm = (function () {
return;
}
buildChart(resp.samples, 'Sample Nr.', 'ADC value');
buildChart(json.samples, 'Sample Nr.', 'ADC value');
}
wfm.init = function() {
@ -86,10 +86,19 @@ var wfm = (function () {
// "success": true
// };
$('#load').on('click', function() {
function clickHdl() {
var samples = $('#count').val();
$().get('http://192.168.1.13/api/raw.json?n='+samples, onRxData, true, true);
//http://192.168.1.13
$().get('/api/raw.json?n='+samples, onRxData, true, true);
}
$('#load').on('click', clickHdl);
$('#count').on('keyup', function(e) {
if (e.which == 13) {
clickHdl();
}
});
};

5289
html_src/js/all.js

File diff suppressed because one or more lines are too long

2
html_src/js/all.js.map

File diff suppressed because one or more lines are too long

3
html_src/sass/app.scss

@ -1,5 +1,4 @@
@import "normalize";
@import "lib/chartist/chartist";
@import "lib/bourbon/bourbon";
@import "grid-settings";
@ -7,6 +6,8 @@
@import "utils/index";
@import "lib/chartist/chartist";
$form-label-w: 130px;
$form-label-gap: 8px;
$form-field-w: 250px;

1
html_src/sass/lib/chartist/_chartist.scss

@ -116,6 +116,7 @@
.ct-axis-title {
fill: $ct-axis-label-color;
@include noselect;
}
// --- Label ---

35
libesphttpd/core/httpd.c

@ -28,6 +28,8 @@ Esp8266 http server - core routines
//size of the backlog.
#define MAX_BACKLOG_SIZE (4*1024)
#define MAX_CORS_TOKEN_LEN 256
//This gets set at init time.
static HttpdBuiltInUrl *builtInUrls;
@ -48,6 +50,7 @@ struct HttpSendBacklogItem {
//Private data for http connection
struct HttpdPriv {
char head[MAX_HEAD_LEN];
char corsToken[MAX_CORS_TOKEN_LEN];
int headPos;
char *sendBuff;
int sendBuffLen;
@ -91,15 +94,24 @@ static const ICACHE_RODATA_ATTR MimeMap mimeTypes[]={
};
//Returns a static char* to a mime type for a given url to a file.
const char ICACHE_FLASH_ATTR *httpdGetMimetype(const char *url) {
const char ICACHE_FLASH_ATTR *httpdGetMimetype(const char *filepath) {
int i=0;
//Go find the extension
const char *ext=url+(strlen(url)-1);
while (ext!=url && *ext!='.') ext--;
//Go find the extension (searching from the end)
const char *ext=filepath+(strlen(filepath)-1);
while (ext!=filepath && *ext!='.') ext--;
if (*ext=='.') ext++;
//ToDo: strcmp is case sensitive; we may want to do case-intensive matching here...
while (mimeTypes[i].ext!=NULL && strcmp(ext, mimeTypes[i].ext)!=0) i++;
if (mimeTypes[i].ext == NULL) {
// we didn't find any proper match
if (strncmp(filepath, "/json/", 6) == 0) {
// if it's in the json folder, it surely is json!
return "application/json";
}
}
return mimeTypes[i].mimetype;
}
@ -508,6 +520,18 @@ static void ICACHE_FLASH_ATTR httpdProcessRequest(HttpdConnData *conn) {
error("WtF? url = NULL");
return; //Shouldn't happen
}
if (conn->requestType == HTTPD_METHOD_OPTIONS /*&& conn->priv->chunkHdr[0] != 0*/) {
// we have a CORS preflight
httpdStartResponse(conn, 200);
httpdHeader(conn, "Access-Control-Allow-Headers", conn->priv->corsToken);
httpdEndHeaders(conn);
httpdCgiIsDone(conn);
dbg("CORS preflight resp sent.");
return;
}
//See if we can find a CGI that's happy to handle the request.
while (1) {
//Look up URL in the built-in URL table.
@ -647,7 +671,7 @@ static void ICACHE_FLASH_ATTR httpdParseHeader(char *h, HttpdConnData *conn) {
// int len = strlen(h);
// info("h = %s, len %d", h, len);
//strcpy(conn->priv->corsReqHdrs, h+32);//MAX_CORS_HDR_LEN
strncpy(conn->priv->corsToken, h+32, MAX_CORS_TOKEN_LEN);
}
}
@ -661,6 +685,7 @@ void httpdRecvCb(ConnTypePtr rconn, char *remIp, int remPort, char *data, unsign
if (conn==NULL) return;
conn->priv->sendBuff=sendBuff;
conn->priv->sendBuffLen=0;
conn->priv->corsToken[0] = 0;
//This is slightly evil/dirty: we abuse conn->post->len as a state variable for where in the http communications we are:
//<0 (-1): Post len unknown because we're still receiving headers

2
libesphttpd/html-minifier-conf.json

@ -3,7 +3,7 @@
"removeCommentsFromCDATA": true,
"removeCDATASectionsFromCDATA": true,
"collapseWhitespace": true,
"conservativeCollapse": false,
"conservativeCollapse": true,
"collapseBooleanAttributes": true,
"removeTagWhitespace": true,
"removeAttributeQuotes": true,

3
web-gbuild.sh

@ -0,0 +1,3 @@
#!/bin/bash
xterm -title "ESP gulp build" -e "source $HOME/.bashrc && cd html_src && gulp"

2
web-gwatch.sh

@ -1,3 +1,3 @@
#!/bin/bash
xterm -title "ESP html build" -e "source $HOME/.bashrc && cd html_src && gulp watch"
xterm -title "ESP gulp watch" -e "source $HOME/.bashrc && cd html_src && gulp watch"

Loading…
Cancel
Save