Changeset 1142


Ignore:
Timestamp:
09/09/11 14:02:09 (22 months ago)
Author:
thomas
Message:

KA-based synchronized. This fixes #59.

Location:
firmware/openos/openwsn
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • firmware/openos/openwsn/02b-RES/res.c

    r1135 r1142  
    1616//=========================== variables ======================================= 
    1717 
    18 enum { 
    19    MAC_MGT_TASK_ADV     = 0, 
    20    MAC_MGT_TASK_KA      = 1, 
    21    MAC_MGT_TASK_MAX     = 2, 
    22 }; 
    23  
    2418typedef struct { 
    2519   uint16_t periodMaintenance; 
    26    bool     busySending;     // TRUE when busy sending an advertisement or keep-alive 
    27    uint8_t  dsn;             // current data sequence number 
    28    uint8_t  MacMgtTask;      // MAC management task to execute 
     20   bool     busySending;          // TRUE when busy sending an advertisement or keep-alive 
     21   uint8_t  dsn;                  // current data sequence number 
     22   uint8_t  MacMgtTaskCounter;    // counter to determine what management task to do 
    2923} res_vars_t; 
    3024 
     
    4337   res_vars.busySending       = FALSE; 
    4438   res_vars.dsn               = 0; 
    45    res_vars.MacMgtTask        = MAC_MGT_TASK_ADV; 
     39   res_vars.MacMgtTaskCounter = 0; 
    4640   timer_startPeriodic(TIMER_RES,res_vars.periodMaintenance); 
    4741} 
     
    161155has fired. This timer is set to fire every second, on average. 
    162156 
    163 The body of this function executes one of the MAC management task, alternating 
    164 between all in a round-robin fashion. 
     157The body of this function executes one of the MAC management task. 
    165158*/ 
    166159void timer_res_fired() { 
    167    res_vars.MacMgtTask = (res_vars.MacMgtTask+1)%MAC_MGT_TASK_MAX; 
    168    switch (res_vars.MacMgtTask) { 
    169       case MAC_MGT_TASK_ADV: 
    170          sendAdv(); 
    171          break; 
    172       case MAC_MGT_TASK_KA: 
    173          //sendKa();//poipoi disable KA's 
    174          break; 
    175       default: 
    176          res_vars.MacMgtTask=0;//this should never happen 
     160   res_vars.MacMgtTaskCounter = (res_vars.MacMgtTaskCounter+1)%10; 
     161   if (res_vars.MacMgtTaskCounter==0) { 
     162      sendAdv(); 
     163   } else { 
     164      sendKa(); 
    177165   } 
    178166} 
     
    282270      kaNeighAddr = neighbors_KaNeighbor(); 
    283271      if (kaNeighAddr!=NULL) { 
    284          // debug 
    285          openserial_printError(COMPONENT_RES, 
    286                                ERR_POIPOI, 
    287                                0, 
    288                                0); 
    289272         // get a free packet buffer 
    290273         ka = openqueue_getFreePacketBuffer(); 
  • firmware/openos/openwsn/07-App/appudptimer.c

    r1137 r1142  
    2222void appudptimer_init() { 
    2323   appudptimer_vars.busySending = FALSE; 
    24    timer_startPeriodic(TIMER_UDPTIMER,32768); 
     24   //timer_startPeriodic(TIMER_UDPTIMER,32768); 
    2525} 
    2626 
  • firmware/openos/openwsn/openwsn.h

    r1141 r1142  
    6464// de-synchronization timeouts 
    6565enum { 
    66    DESYNCTIMEOUT                       = 300, // in slots: @10ms per slot -> 3 seconds 
     66   DESYNCTIMEOUT                       = 500, // in slots: @10ms per slot -> 5 seconds 
    6767   KATIMEOUT                           = 100, // in slots: @10ms per slot -> 1 second 
    6868}; 
Note: See TracChangeset for help on using the changeset viewer.