X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=web%2Fgui.js;h=e49cf4d4d6fbcd299f9a64203f736b4a3abc5ac0;hb=f677f4f422f9e4efd4cf83eea8ec271bb38f53d5;hp=da4e0d048326177010f7f643e6771aca60a642d6;hpb=9839a36649fbd852835693ec2096c4601372b7c1;p=matches%2FMCTX3420.git diff --git a/web/gui.js b/web/gui.js index da4e0d0..e49cf4d 100644 --- a/web/gui.js +++ b/web/gui.js @@ -8,9 +8,27 @@ $(document).ready(function() { g_sensors = [] - g_numSensors = 2 + g_numSensors = 1 g_storeTime = [] g_key = null + g_led = 1 + + $.fn.ledFlash = function() + { + //alert("Flash LED"); + if (g_led == 0) + { + $.ajax({url : "api/actuators", data : {id : 0, set : 1}}) + g_led = 1 + $("#led").html("LED On"); + } + else + { + $.ajax({url : "api/actuators", data : {id : 0, set : 0}}) + g_led = 0 + $("#led").html("LED Off"); + } + } $.fn.pruneSensorData = function(id) { @@ -44,7 +62,7 @@ $(document).ready(function() $.fn.updateSensor = function(json) { //console.log(json.data) - var sensor = g_sensors[json.id] + var sensor = g_sensors[0] var most_recent = null if (sensor.length > 0) most_recent = sensor[sensor.length-1][0] @@ -62,7 +80,7 @@ $(document).ready(function() //console.log("Plot:") //console.log(g_sensors[json.id]) - $.plot("#sensor"+String(json.id)+"_plot", [g_sensors[json.id]]) + $.plot("#sensor"+String(0)+"_plot", [g_sensors[0]]) $.ajax({url : "/api/sensors", data : {id : json.id}, success : function(data) {$(this).updateSensor(data);}}); // @@ -112,8 +130,7 @@ $(document).ready(function() $("#plots").html(plotsHTML) controlHTML = "
Pressure: " - controlHTML += "
" + controlHTML += "" $("#controls").html(controlHTML) @@ -127,7 +144,7 @@ $(document).ready(function() for (var i = 0; i < g_numSensors; ++i) { - // $.ajax({url : "/api/sensors", data : {id : i}, success : function(data) {$(this).updateSensor(data);}}) + $.ajax({url : "/api/sensors", data : {id : 2}, success : function(data) {$(this).updateSensor(data);}}) } });