-/**
-* Sets the camera autoupdater
-* Obsolete?
-* @returns {$.fn}
-*/
-$.fn.setCamera = function () {
- var url = mctx.api + "image"; //http://beaglebone/api/image
- var update = true;
-
- //Stop updating if we can't retrieve an image!
- this.error(function() {
- update = false;
- });
-
- var parent = this;
-
- var updater = function() {
- if (!update) {
- alert("Cam fail");
- parent.attr("src", "");
- return;
- }
-
- parent.attr("src", url + "#" + (new Date()).getTime());
-
- setTimeout(updater, 10000);
- };
-
- updater();
- return this;
-};
-
-/**
-* Sets the strain graphs to graph stuff. Obsolete?
-* @returns {$.fn}
-*/
-$.fn.setStrainGraphs = function () {
- var sensor_url = mctx.api + "sensors";
- var graphdiv = this;
-
- var updater = function () {
- var time_limit = mctx.strain_gauges.time_limit;
- var responses = new Array(mctx.strain_gauges.ids.length);
-
- for (var i = 0; i < mctx.strain_gauges.ids.length; i++) {
- var parameters = {id : i, start_time: -time_limit};
- responses[i] = $.ajax({url : sensor_url, data : parameters});
- }
-
- $.when.apply(this, responses).then(function () {
- var data = new Array(arguments.length);
- for (var i = 0; i < arguments.length; i++) {
- var raw_data = arguments[i][0].data;
- var pruned_data = [];
- var step = ~~(raw_data.length/100);
- for (var j = 0; j < raw_data.length; j += step)
- pruned_data.push(raw_data[j]);
- data[i] = pruned_data;
- }
- $.plot(graphdiv, data);
- setTimeout(updater, 1000);
- }, function () {debugLog("It crashed");});
- };
-
- updater();
- return this;
-};
-