updated some comments
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 8 Dec 2010 07:20:19 +0000 (07:20 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 8 Dec 2010 07:20:19 +0000 (07:20 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@266 01035d8c-6547-0410-b346-abe4f91aad63

dilimesh/dilimesh/dilimesh.html

index 8a2d724666dedfb85fda3c815683851a602ce059..0abf1c3374ce781fe7832eb261cf85f9ef3ef562 100644 (file)
@@ -73,6 +73,7 @@
     var myOptions = {
       zoom: myzoom,
       center: myLatlng,
+      scaleControl: true,
       mapTypeId: google.maps.MapTypeId.ROADMAP
     }
     map = new google.maps.Map(document.getElementById("main-map"), myOptions);
     if (ips != "") {
       downloadUrl("/cgi-bin/fpingnodes.cgi?" + ips, processFping);
 
-      // set up HTML for ping tests of all nodes
+      // set up HTML for manual ping test
     
       var html = '<a href="/cgi-bin/fpingnodes.cgi?' + ips + ' ">Ping nodes</a>';
       document.getElementById('ping_nodes').innerHTML = html;
     }
 
-    // fire off next sig strength
+    // fire off next sig strength CGI, we iterate these over time to keep
+    // network load nominal
 
     if (nodes[sigstr_node_index] != undefined) {
       downloadUrl("/cgi-bin/getsig.cgi?ip=" + nodes[sigstr_node_index].ip, processgetSig);
   }
 
 
+  // this function calls itself every update_time seconds
+  // used for peridoic updates (polling) of network stats
+
   function timer() {
     var today=new Date();
     var h=today.getHours();
   }
 
 
+  // called when Fping CGI returns
+
   function processFping(doc, status) {
 
     //log("processFping");
   }
 
 
+  // remove leading and trailing whitespace from a string
+
   function trim(stringToTrim) {
        return stringToTrim.replace(/^\s+|\s+$/g,"");
   }
 
-  // process signal strengths from CGI
+
+  // called when getsig.cgi returns to grok signal
+  // strength information
 
   function processgetSig(doc, status) {
     log("processgetSig");
           google.maps.event.addListener(path, "click", function() {
             var path = this.getPath();
             var dist = distHaversine(path.b[0], path.b[1]) * 1000;
-            var path_loss = 100.0 + 20*Math.log(dist/1000)/Math.log(10);
-            path_loss =  Math.round(path_loss);
 
             // est rx power: 
-            //   MP tx pwr between 15 and 20dB depending on rate
-            //   roughly 2dB antennas
+            //   MP tx pwr between 15 and 20dB depending on rate, so use 17dB
+            //   roughly 2dB tx and rx antennas
+            //   100dB loss for 1000m, 6dB more for double distance
 
+            var path_loss = 100.0 + 20*Math.log(dist/1000)/Math.log(10);
+            path_loss =  Math.round(path_loss);
             var est_rx_sig = 17 + 2 + 2 - path_loss;
 
             document.getElementById('distance').innerHTML = dist + ' m';
   }
 
 
-  // sets up map side for new Node
+  // sets up map for a new Node
   // adds node to nodes[] array but doesn't write to text file
 
   function addNewNode(lat, lng, newIp, isNewNode) {
   }
 
 
-  // save our map location and zoom using a cookie
+  // save state 9config info) to our cookie
 
   function setCookie() {
     var cookietext = cookiename;
 
 
   // called when we click to add a node on map
-  // not used much as normally we auto-detect new nodes from Vis server
 
   function placeMarker(location, ip, isNewNode) {
     if (ip == undefined) {