From 405c90a5f1a40c540bb27553077b3d01203fe622 Mon Sep 17 00:00:00 2001 From: Jeremy Tan Date: Wed, 23 Oct 2013 20:56:47 +0800 Subject: [PATCH] Add in live values data page + minor gui fixes --- server/actuator.c | 6 + server/actuator.h | 1 + server/fastcgi.c | 2 +- testing/MCTXWeb/public_html/control.html | 46 +---- testing/MCTXWeb/public_html/data.html | 1 + testing/MCTXWeb/public_html/graph.html | 1 + testing/MCTXWeb/public_html/help.html | 1 + testing/MCTXWeb/public_html/index.html | 1 + testing/MCTXWeb/public_html/pintest.html | 1 + .../MCTXWeb/public_html/static/mctx.graph.js | 7 +- testing/MCTXWeb/public_html/values.html | 173 ++++++++++++++++++ 11 files changed, 196 insertions(+), 44 deletions(-) create mode 100644 testing/MCTXWeb/public_html/values.html diff --git a/server/actuator.c b/server/actuator.c index 617136e..7473485 100644 --- a/server/actuator.c +++ b/server/actuator.c @@ -457,3 +457,9 @@ Actuator * Actuator_Identify(const char * name) } return NULL; } + +DataPoint Actuator_LastData(int id) +{ + Actuator * a = &(g_actuators[id]); + return a->last_setting; +} diff --git a/server/actuator.h b/server/actuator.h index a5ac75b..46c2f44 100644 --- a/server/actuator.h +++ b/server/actuator.h @@ -86,6 +86,7 @@ extern Actuator * Actuator_Identify(const char * str); // Identify a Sensor from extern void Actuator_Handler(FCGIContext *context, char * params); // Handle a FCGI request for Actuator control extern const char * Actuator_GetName(int id); +extern DataPoint Actuator_LastData(int id); #endif //_ACTUATOR_H diff --git a/server/fastcgi.c b/server/fastcgi.c index 75863c1..76ce61f 100644 --- a/server/fastcgi.c +++ b/server/fastcgi.c @@ -78,7 +78,7 @@ static void IdentifyHandler(FCGIContext *context, char *params) FCGI_JSONValue(",\n\t\t"); } - DataPoint d = Sensor_LastData(i); + DataPoint d = Actuator_LastData(i); FCGI_JSONValue("\"%d\" : {\"name\" : \"%s\", \"value\" : [%f, %f] }", i, Actuator_GetName(i), d.time_stamp, d.value); } FCGI_JSONValue("\n\t}"); diff --git a/testing/MCTXWeb/public_html/control.html b/testing/MCTXWeb/public_html/control.html index 5d22e90..18769d2 100644 --- a/testing/MCTXWeb/public_html/control.html +++ b/testing/MCTXWeb/public_html/control.html @@ -18,6 +18,8 @@ $(document).ready(function () { $("form").submit(function () { //Prevent form submit globally return false; + }).each(function () { + this.reset(); }); //Set the status updated @@ -50,7 +52,8 @@ }); $("#pressure-controls input[name='clear']").click(function () { - $("#pressure-set")[0].reset(); + $("#pressure-controls")[0].reset(); + $("#pressure-result").text(""); }); $("#pressure-controls input[name='zero']").click(function () { @@ -133,6 +136,7 @@
  • Home
  • Experiment control
  • Experiment graphs
  • +
  • Experiment data (live)
  • Experiment data
  • Pin debugging
  • Help
  • @@ -234,46 +238,6 @@

    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Link
    -
    -
    - diff --git a/testing/MCTXWeb/public_html/data.html b/testing/MCTXWeb/public_html/data.html index c4c2807..881f0ae 100644 --- a/testing/MCTXWeb/public_html/data.html +++ b/testing/MCTXWeb/public_html/data.html @@ -102,6 +102,7 @@
  • Home
  • Experiment control
  • Experiment graphs
  • +
  • Experiment data (live)
  • Experiment data
  • Pin debugging
  • Help
  • diff --git a/testing/MCTXWeb/public_html/graph.html b/testing/MCTXWeb/public_html/graph.html index 1b8361f..09e792a 100644 --- a/testing/MCTXWeb/public_html/graph.html +++ b/testing/MCTXWeb/public_html/graph.html @@ -74,6 +74,7 @@
  • Home
  • Experiment control
  • Experiment graphs
  • +
  • Experiment data (live)
  • Experiment data
  • Pin debugging
  • Help
  • diff --git a/testing/MCTXWeb/public_html/help.html b/testing/MCTXWeb/public_html/help.html index 5760c4e..4daf5a8 100644 --- a/testing/MCTXWeb/public_html/help.html +++ b/testing/MCTXWeb/public_html/help.html @@ -59,6 +59,7 @@
  • Home
  • Experiment control
  • Experiment graphs
  • +
  • Experiment data (live)
  • Experiment data
  • Pin debugging
  • Help
  • diff --git a/testing/MCTXWeb/public_html/index.html b/testing/MCTXWeb/public_html/index.html index b91db20..f265780 100644 --- a/testing/MCTXWeb/public_html/index.html +++ b/testing/MCTXWeb/public_html/index.html @@ -70,6 +70,7 @@
  • Home
  • Experiment control
  • Experiment graphs
  • +
  • Experiment data (live)
  • Experiment data
  • Pin debugging
  • Help
  • diff --git a/testing/MCTXWeb/public_html/pintest.html b/testing/MCTXWeb/public_html/pintest.html index 9372ee8..92abf93 100644 --- a/testing/MCTXWeb/public_html/pintest.html +++ b/testing/MCTXWeb/public_html/pintest.html @@ -105,6 +105,7 @@
  • Home
  • Experiment control
  • Experiment graphs
  • +
  • Experiment data (live)
  • Experiment data
  • Pin debugging
  • Help
  • diff --git a/testing/MCTXWeb/public_html/static/mctx.graph.js b/testing/MCTXWeb/public_html/static/mctx.graph.js index fd475ad..851fff2 100644 --- a/testing/MCTXWeb/public_html/static/mctx.graph.js +++ b/testing/MCTXWeb/public_html/static/mctx.graph.js @@ -66,14 +66,17 @@ $.fn.deployDevices = function(input_type, check_first, group) { var container = this; var apply = function(dict, prefix) { $.each(dict, function(key, val) { + //Unique id (name mangling) + var id = container.attr('id') + "_" + prefix + "_" + val.name; + var attributes = { 'type' : input_type, 'value' : key, 'alt' : val.name, 'class' : prefix, 'name' : group, - 'id' : prefix + '_' + val.name //Unique id (name mangling) + 'id' : id }; var entry = $("", attributes); - var label = $("