chart improvements

master
Ondřej Hruška 9 years ago
parent 5e8f8cc4b1
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

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!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> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -3,6 +3,8 @@ var autoprefixer = require('autoprefixer');
elixir.config.css.autoprefix.options.browsers = ["> 2.5% in CZ"]; elixir.config.css.autoprefix.options.browsers = ["> 2.5% in CZ"];
elixir.config.css.autoprefix.options.flexbox = "no-2009"; 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(); // var info = autoprefixer(elixir.config.css.autoprefix).info();
// console.log(info); // console.log(info);

@ -77,7 +77,7 @@ var wfm = (function () {
return; return;
} }
buildChart(resp.samples, 'Sample Nr.', 'ADC value'); buildChart(json.samples, 'Sample Nr.', 'ADC value');
} }
wfm.init = function() { wfm.init = function() {
@ -86,10 +86,19 @@ var wfm = (function () {
// "success": true // "success": true
// }; // };
$('#load').on('click', function() { function clickHdl() {
var samples = $('#count').val(); 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();
}
}); });
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

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

@ -28,6 +28,8 @@ Esp8266 http server - core routines
//size of the backlog. //size of the backlog.
#define MAX_BACKLOG_SIZE (4*1024) #define MAX_BACKLOG_SIZE (4*1024)
#define MAX_CORS_TOKEN_LEN 256
//This gets set at init time. //This gets set at init time.
static HttpdBuiltInUrl *builtInUrls; static HttpdBuiltInUrl *builtInUrls;
@ -48,6 +50,7 @@ struct HttpSendBacklogItem {
//Private data for http connection //Private data for http connection
struct HttpdPriv { struct HttpdPriv {
char head[MAX_HEAD_LEN]; char head[MAX_HEAD_LEN];
char corsToken[MAX_CORS_TOKEN_LEN];
int headPos; int headPos;
char *sendBuff; char *sendBuff;
int sendBuffLen; 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. //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; int i=0;
//Go find the extension //Go find the extension (searching from the end)
const char *ext=url+(strlen(url)-1); const char *ext=filepath+(strlen(filepath)-1);
while (ext!=url && *ext!='.') ext--; while (ext!=filepath && *ext!='.') ext--;
if (*ext=='.') ext++; if (*ext=='.') ext++;
//ToDo: strcmp is case sensitive; we may want to do case-intensive matching here... //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++; 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; return mimeTypes[i].mimetype;
} }
@ -508,6 +520,18 @@ static void ICACHE_FLASH_ATTR httpdProcessRequest(HttpdConnData *conn) {
error("WtF? url = NULL"); error("WtF? url = NULL");
return; //Shouldn't happen 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. //See if we can find a CGI that's happy to handle the request.
while (1) { while (1) {
//Look up URL in the built-in URL table. //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); // int len = strlen(h);
// info("h = %s, len %d", h, len); // 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; if (conn==NULL) return;
conn->priv->sendBuff=sendBuff; conn->priv->sendBuff=sendBuff;
conn->priv->sendBuffLen=0; 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: //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 //<0 (-1): Post len unknown because we're still receiving headers

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

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

@ -1,3 +1,3 @@
#!/bin/bash #!/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