Add navigation menu
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / pintest.html
index 5d0527b..10310c7 100644 (file)
@@ -1,48 +1,94 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
   <head>
-    <title>BeagleBone Black Pin Test</title>
+    <title>MCTX3420 Web Interface</title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <!--[if lte IE 8]>
-      <script language="javascript" type="text/javascript" src="static/excanvas.min.js"></script>
-    <![endif]-->
     <script type="text/javascript" src="static/jquery-1.10.1.min.js"></script>
-    <script type="text/javascript" src="static/jquery.flot.min.js"></script>
-    <script type="text/javascript" src="static/base64.js"></script>
     <script type="text/javascript" src="static/mctx.gui.js"></script>
     <script type="text/javascript" src="static/mctx.pintest.js"></script>
     
     <link rel="stylesheet" type="text/css" href="static/style.css">
     <link rel="stylesheet" type="text/css" href="static/nav-menu.css">
     <script type="text/javascript">
-      $(document).ready(function () {
-        $("#errorlog").setErrorLog();
-        $("#gpio-menu").populateDropdown(mctx.pintest.gpios, "GPIO ");
-        $("#pwm-menu").populateDropdown(mctx.pintest.pwms, "PWM ");
-        
-        $("#gpio-go").click(function () {
-          if ($("#gpio-menu").val()) {
-            $("#gpio-container").exportGPIO($("#gpio-menu"));
-          }
-        });
-        $("#pwm-go").click(function () {
-          if ($("#pwm-menu").val()) {
-            $("#pwm-container").exportPWM($("#pwm-menu"));
-          }
+      runBeforeLoad().done(function () {
+        //Ensure stuff is unloaded before leaving the page
+        $(window).unload(function(){
+          $("#adc-controls").find("input[type='checkbox']")
+          .each(function () {
+            if ($(this).is(":checked")) {
+              $(this).trigger("click");
+            }
+          });
+          $("#gpio-container").find("input[name='unexport']")
+          .each(function () {
+            $(this).trigger("click");
+          });
+          $("#pwm-container").find("input[name='unexport']")
+          .each(function () {
+            $(this).trigger("click");
+          });
         });
-      });
+        
+        $(document).ready(function () {
+         //Set the welcome bar
+         var name = " " + (mctx.friendlyName ? mctx.friendlyName : "");
+         $("#welcome-container").text("Welcome"+ name + "!");
+         $("#content").css("display", "block");
+
+         $("#logout").click(function () {
+           $("#logout").logout();
+         });
+
+         $("#gpio-menu").populateDropdown(mctx.pintest.gpios, "GPIO ");
+         $("#pwm-menu").populateDropdown(mctx.pintest.pwms, "PWM ");
+
+         $("#gpio-go").click(function () {
+           if ($("#gpio-menu").val()) {
+             $(this).attr("disabled", true);
+             $("#gpio-container").exportGPIO($("#gpio-menu")).always(function () {
+               $("#gpio-go").attr("disabled", false);
+             });
+           }
+         });
+         $("#pwm-go").click(function () {
+           if ($("#pwm-menu").val()) {
+             $(this).attr("disabled", true);
+             $("#pwm-container").exportPWM($("#pwm-menu")).always(function () {
+               $("#pwm-go").attr("disabled", false);
+             });
+           }
+         });
+         $("#adc-controls").trigger("reset").setADCControl();
+
+         $("#errorlog").setErrorLog();
+       });
+      })
+
     </script>
   </head>
   
   <body>
     <div id="header">
-      <span id="title">BBB pin test</span>
+      <div id="leftnav">
+        <a href="http://www.uwa.edu.au/" target="_blank">
+          <img alt = "The University of Western Australia"
+          src="static/uwacrest-text.png">
+        </a>
+        <span id="title">BBB Pin test (debug only)</span>
+      </div>
       <div id="rightnav">
-        <div id="menu-container" class="nav-menu">
-        </div>
+        <span id="welcome-container">
+        </span>
         <span id="date">
           <script type="text/javascript">getDate();</script>
         </span>
+        <div id="logout-container">
+          <form action="#">
+            <div>
+              <input type="button" id="logout" value="Logout">
+            </div>
+          </form>
+        </div>
       </div>
       <div class="clear"></div>
     </div>
     
     <div id="content">
       <div id="sidebar">
+        <div class="widget">
+          <div class="title">Navigation menu</div>
+          <div class="nav-menu">
+          <ul>
+             <li><a href="index.html"><span>Home</span></a></li>
+             <li><a href="control.html"><span>Experiment control</span></a></li>
+             <li><a href="pintest.html"><span>Pin debugging</span></a></li>
+             <li class="last"><a href="#"><span>Help</span></a></li>
+          </ul>
+          </div>
+        </div>
         <div class="widget">
           <div class="title">Info</div>
           <p>This test page gives control over the BBB's pins.
         </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>
 
         <div class="widget">
           <div class="title">Analogue input (ADC)</div>
-          <form class="controls" action="#">
+          <form class="controls" action="#" id="adc-controls">
             <table class="centre">
               <tr>
                 <td>AIN</td><th>0</th><th>1</th><th>2</th><th>3</th>

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