From: Jeremy Tan Date: Sun, 29 Sep 2013 12:11:39 +0000 (+0800) Subject: Pin test page cleanup X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=989a1d2ff5f5afc20f78738f57cc829ae9d11e99;p=matches%2FMCTX3420.git Pin test page cleanup --- diff --git a/server/pin_test.c b/server/pin_test.c index 90ae626..86685e8 100644 --- a/server/pin_test.c +++ b/server/pin_test.c @@ -36,9 +36,8 @@ bool Pin_Configure(const char *type, int pin_export, int num) if (strcmp(type, "gpo") == 0 || strcmp(type, "gpi") == 0) { - if (pin_export < 0) - GPIO_Unexport(num); - else + //Don't allow unexport of gpio + if (pin_export > 0) ret = GPIO_Export(num); } else if (strcmp(type, "pwm") == 0) @@ -50,9 +49,8 @@ bool Pin_Configure(const char *type, int pin_export, int num) } else if (strcmp(type, "adc") == 0) { - if (pin_export < 0) - ADC_Unexport(num); - else + //Don't allow unexport of adc + if (pin_export > 0) ret = ADC_Export(num); } return ret; @@ -172,7 +170,7 @@ void Pin_Handler(FCGIContext *context, char * params) else { FCGI_PrintRaw("Content-type: text/plain\r\n\r\n"); - FCGI_PrintRaw("ADC%d reads %d\n", num, raw_adc); + FCGI_PrintRaw("%d\n", raw_adc); } } else if (strcmp(type, "pwm") == 0) diff --git a/testing/MCTXWeb/public_html/static/mctx.gui.js b/testing/MCTXWeb/public_html/static/mctx.gui.js index 82f823c..606c0be 100644 --- a/testing/MCTXWeb/public_html/static/mctx.gui.js +++ b/testing/MCTXWeb/public_html/static/mctx.gui.js @@ -188,6 +188,9 @@ $.fn.setErrorLog = function () { var updater = function () { $.ajax({url : url}).done(function (data) { outdiv.text(data); + outdiv.scrollTop( + outdiv[0].scrollHeight - outdiv.height() + ); setTimeout(updater, 1000); }).fail(function (jqXHR) { outdiv.text("Failed to retrieve the error log."); diff --git a/testing/MCTXWeb/public_html/static/mctx.pintest.js b/testing/MCTXWeb/public_html/static/mctx.pintest.js index 1e2d2d9..d2ea59e 100644 --- a/testing/MCTXWeb/public_html/static/mctx.pintest.js +++ b/testing/MCTXWeb/public_html/static/mctx.pintest.js @@ -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);