+ $("form").submit(function () { //Prevent form submit globally
+ return false;
+ }).trigger("reset"); //Reset forms
+
+ //Force enable start buttons if previously disabled
+ $("#start-controls input[type='button']").removeAttr("disabled");
+
+ //Set the status updated
+ $("#state-exp").setStatusUpdater();
+
+ //Set the logic for the start controls
+ $("#start-controls input[type='button']").click(function () {
+ var start = $("#start-controls input[type='button']");
+ var force = $("#start-controls input[name='start_force']");
+
+ $(this).startExperiment(start, $("#experiment_name").val(),
+ force.is(":checked"), $("#start-result"));
+ force.prop("checked", false);
+ });
+
+ //Set the logic for the stop button
+ $("#experiment-stop").click(function () {
+ $(this).stopExperiment($("#stop-status"));
+ });
+
+ //Set the logic for the pressure controls
+ $("#pressure-controls").submit(function () {
+ var pressure = {
+ set : $("#pressure-set").val(),
+ step : $("#pressure-stepsize").val(),
+ wait : $("#pressure-stepwait").val(),
+ count : $("#pressure-stepcount").val()
+ };
+ $(this).setPressure(pressure, $("#pressure-result"));
+ });
+
+ $("#pressure-controls input[name='clear']").click(function () {
+ $("#pressure-controls")[0].reset();
+ $("#pressure-result").text("");
+ });
+
+ $("#pressure-controls input[name='zero']").click(function () {
+ $("#pressure-controls input[name='clear']").click();
+ $("#pressure-set").val("0");
+
+ $("#pressure-controls").submit();
+ });
+
+ $("#pressure-controls input[name='step-it']").click(function () {
+ var pressure = {
+ set : $("#pressure-set").val(), step : "", wait : "", count : ""
+ };
+
+ $(this).setPressure(pressure, $("#pressure-result")).done(function () {
+ var next = Number($("#pressure-set").val()) + Number($("#pressure-stepsize").val());
+ $("#pressure-set").val(next.toString());
+ });
+
+ });
+ $("#samplerate-controls").submit(function () {
+ setSampleRate($("#sensor-select option:selected").val(),
+ $("#sensor-set").val(), $("#samplerate-result"));
+ });