[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/ctp CtpRoutingEngineP.nc, 1.1.2.17, 1.1.2.18

Phil Levis scipio at users.sourceforge.net
Wed Nov 1 13:53:50 PST 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv2312

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	CtpRoutingEngineP.nc 
Log Message:
Fixed timer calculation.


Index: CtpRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/Attic/CtpRoutingEngineP.nc,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -C2 -d -r1.1.2.17 -r1.1.2.18
*** CtpRoutingEngineP.nc	30 Oct 2006 00:53:39 -0000	1.1.2.17
--- CtpRoutingEngineP.nc	1 Nov 2006 21:53:47 -0000	1.1.2.18
***************
*** 85,91 ****
   *  when a node is root its hopcount and metric are 0, and the parent is
   *  itself. A root always has a valid route, to itself.
!  */
! 
!  /* 
   *  @author Rodrigo Fonseca
   *  @author Philip Levis (added trickle-like updates)
--- 85,89 ----
   *  when a node is root its hopcount and metric are 0, and the parent is
   *  itself. A root always has a valid route, to itself.
!  *
   *  @author Rodrigo Fonseca
   *  @author Philip Levis (added trickle-like updates)
***************
*** 166,177 ****
  
      uint16_t currentInterval = minInterval;
      bool tHasPassed;
  
      void chooseAdvertiseTime() {
!        uint32_t t = currentInterval * 512; // * 1024 / 2
         t += call Random.rand32() % t;
         tHasPassed = FALSE;
         call BeaconTimer.stop();
!        call BeaconTimer.startPeriodic(t);
      }
  
--- 164,177 ----
  
      uint16_t currentInterval = minInterval;
+     uint32_t t; 
      bool tHasPassed;
  
      void chooseAdvertiseTime() {
!        t = currentInterval;
!        t *= 512; // * 1024 / 2
         t += call Random.rand32() % t;
         tHasPassed = FALSE;
         call BeaconTimer.stop();
!        call BeaconTimer.startOneShot(t);
      }
  
***************
*** 192,196 ****
  
      void remainingInterval() {
!        uint32_t t = (currentInterval * 1024) - call BeaconTimer.getdt();
         tHasPassed = TRUE;
         call BeaconTimer.startPeriodic(t);
--- 192,198 ----
  
      void remainingInterval() {
!        uint32_t remaining = currentInterval;
!        remaining *= 1024;
!        remaining -= t;
         tHasPassed = TRUE;
         call BeaconTimer.startPeriodic(t);
***************
*** 430,433 ****
--- 432,436 ----
            post updateRouteTask(); //always send the most up to date info
            post sendBeaconTask();
+           dbg("RoutingTimer", "Beacon timer fired at %s\n", sim_time_string());
            remainingInterval();
          }



More information about the Tinyos-2-commits mailing list