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)
}
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;
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)
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.");
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);
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) {
})
.always(function () {
dir.attr("disabled", false);
+ set.attr("disabled", false);
});
});
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);