Changeset 1142
- Timestamp:
- 09/09/11 14:02:09 (22 months ago)
- Location:
- firmware/openos/openwsn
- Files:
-
- 3 edited
-
02b-RES/res.c (modified) (4 diffs)
-
07-App/appudptimer.c (modified) (1 diff)
-
openwsn.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
firmware/openos/openwsn/02b-RES/res.c
r1135 r1142 16 16 //=========================== variables ======================================= 17 17 18 enum {19 MAC_MGT_TASK_ADV = 0,20 MAC_MGT_TASK_KA = 1,21 MAC_MGT_TASK_MAX = 2,22 };23 24 18 typedef struct { 25 19 uint16_t periodMaintenance; 26 bool busySending; // TRUE when busy sending an advertisement or keep-alive27 uint8_t dsn; // current data sequence number28 uint8_t MacMgtTask ; // MAC management task to execute20 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 29 23 } res_vars_t; 30 24 … … 43 37 res_vars.busySending = FALSE; 44 38 res_vars.dsn = 0; 45 res_vars.MacMgtTask = MAC_MGT_TASK_ADV;39 res_vars.MacMgtTaskCounter = 0; 46 40 timer_startPeriodic(TIMER_RES,res_vars.periodMaintenance); 47 41 } … … 161 155 has fired. This timer is set to fire every second, on average. 162 156 163 The body of this function executes one of the MAC management task, alternating 164 between all in a round-robin fashion. 157 The body of this function executes one of the MAC management task. 165 158 */ 166 159 void 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(); 177 165 } 178 166 } … … 282 270 kaNeighAddr = neighbors_KaNeighbor(); 283 271 if (kaNeighAddr!=NULL) { 284 // debug285 openserial_printError(COMPONENT_RES,286 ERR_POIPOI,287 0,288 0);289 272 // get a free packet buffer 290 273 ka = openqueue_getFreePacketBuffer(); -
firmware/openos/openwsn/07-App/appudptimer.c
r1137 r1142 22 22 void appudptimer_init() { 23 23 appudptimer_vars.busySending = FALSE; 24 timer_startPeriodic(TIMER_UDPTIMER,32768);24 //timer_startPeriodic(TIMER_UDPTIMER,32768); 25 25 } 26 26 -
firmware/openos/openwsn/openwsn.h
r1141 r1142 64 64 // de-synchronization timeouts 65 65 enum { 66 DESYNCTIMEOUT = 300, // in slots: @10ms per slot -> 3seconds66 DESYNCTIMEOUT = 500, // in slots: @10ms per slot -> 5 seconds 67 67 KATIMEOUT = 100, // in slots: @10ms per slot -> 1 second 68 68 };
Note: See TracChangeset
for help on using the changeset viewer.
