Merge pull request #47 from jtanx/master
authorJeremy Tan <[email protected]>
Sun, 29 Sep 2013 12:33:34 +0000 (05:33 -0700)
committerJeremy Tan <[email protected]>
Sun, 29 Sep 2013 12:33:34 +0000 (05:33 -0700)
pintest cleanup

server/pin_test.c
testing/MCTXWeb/public_html/pinout-table.pdf [new file with mode: 0644]
testing/MCTXWeb/public_html/pintest.html
testing/MCTXWeb/public_html/static/mctx.gui.js
testing/MCTXWeb/public_html/static/mctx.pintest.js

index 90ae626..86685e8 100644 (file)
@@ -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/pinout-table.pdf b/testing/MCTXWeb/public_html/pinout-table.pdf
new file mode 100644 (file)
index 0000000..426d15b
Binary files /dev/null and b/testing/MCTXWeb/public_html/pinout-table.pdf differ
index 0d64c19..921ec8d 100644 (file)
         </div>
         <div class="widget">
           <div class="title">Pin out diagram</div>
-          <p>To see the pin out diagram of the BBB, click <a href="">here</a>.</p>
+          <p>To see the pin out diagram of the BBB, click <a href="pinout-table.pdf" target="_blank">here</a>.</p>
         </div>
         <div class="widget">
-          <div class="title">Unexport?</div>
+          <div class="title">Export/Unexport?</div>
           <p>
-            To 'unexport' a pin means to disable it. Apart from the obvious
+            To export/unexport a pin means to enable/disable it. Apart from the obvious
             use case, sometimes this can be required if you use two PWM channels
             that share the same frequency base.
           </p>
         </div>
         <div class="widget">
           <div class="title">PWM explained</div>
+          <p>The frequency must be a decimal number greater than 0.</p>
           <p>
-            The BBB has up to 8 PWM channels, with 6 having enhanced 
-            resolution.
+            The duty cycle describes the proportion of off/on time per period.
+            This number is specified as a ratio, with values ranging from 0 to 1.
           </p>
           <p>
-            However, those 6 are paired, meaning that each pair must share the
-            same frequency (although the duty cycle can be different).
+            The polarity determines if the duty represents the 'active
+            high' or 'active low' portion. By default, the duty cycle
+            represents the 'active high' portion.
           </p>
         </div>
       </div>
index 82f823c..606c0be 100644 (file)
@@ -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.");
index 1e2d2d9..d2ea59e 100644 (file)
@@ -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);

UCC git Repository :: git.ucc.asn.au