X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.pintest.js;h=d2ea59e3542bfd31d7d6847a511ac00988dbc648;hb=bb0959bbec05c36ab1118ddefc4894faf28f0fa0;hp=f04daad265de2f9335bef39c65fedab7709ad964;hpb=6377ff1447acecdb0496116d983034768773d726;p=matches%2FMCTX3420.git
diff --git a/testing/MCTXWeb/public_html/static/mctx.pintest.js b/testing/MCTXWeb/public_html/static/mctx.pintest.js
index f04daad..d2ea59e 100644
--- a/testing/MCTXWeb/public_html/static/mctx.pintest.js
+++ b/testing/MCTXWeb/public_html/static/mctx.pintest.js
@@ -68,7 +68,7 @@ $.fn.exportPWM = function(menu) {
var container = this;
$.ajax({url : mctx.pintest.api, data : {type : "pwm", num : number, export : "1"}})
- .fail(function () {
+ .done(function () {
var form = $("
", {"class" : "controls", action : "#", id : "pwm-" + number});
var title = $("", {"class" : "centre bold", text : "PWM " + number});
var table = $("", {"class" : "centre"});
@@ -102,7 +102,7 @@ $.fn.exportPWM = function(menu) {
container.append(form);
menu.find("option[value='" + number+"']").remove();
})
- .done(function (jqXHR) {
+ .fail(function (jqXHR) {
alert("Failed to export PWM " + number + ". Is the server running?\n" +
"Error code: " + jqXHR.status);
});
@@ -133,15 +133,14 @@ $.fn.setGPIOControl = function (number, menu) {
dir.click(function () {
dir.attr('disabled', true);
var setOut = dir.val() === "In";
+ result.val("");
if (setOut) {
update = false;
set.attr('disabled', false);
- result.empty();
dir.val("Out");
} else {
update = true;
set.attr('disabled', true);
- result.empty();
dir.val("In");
}
dir.attr('disabled', false);
@@ -149,6 +148,7 @@ $.fn.setGPIOControl = function (number, menu) {
set.click(function () {
dir.attr("disabled", true);
+ set.attr("disabled", true);
var val = (set.val() === "Off") ? 1 : 0;
$.ajax({url : mctx.pintest.api, data : {type : "gpo", num : number, set : val}})
.done(function (data) {
@@ -163,6 +163,7 @@ $.fn.setGPIOControl = function (number, menu) {
})
.always(function () {
dir.attr("disabled", false);
+ set.attr("disabled", false);
});
});
@@ -230,7 +231,12 @@ $.fn.setADCControl = function() {
if (update) {
$.ajax({url : mctx.pintest.api, data : {type : "adc", num : number}})
.done(function (data) {
- result.val(data);
+ if (update) {
+ result.val(data);
+ }
+ })
+ .fail(function () {
+ result.val("fail - server not running?");
})
.always(function () {
setTimeout(updater, mctx.pintest.refreshRate);