Project

General

Profile

Revision 43

Wireless library updated. Ran successfuly for 15 minutes on 4 robots.

View differences:

wl_token_ring.c
15 15

  
16 16
#define DEFAULT_SENSOR_MATRIX_SIZE 20
17 17

  
18
//TODO: idea: if the xbee can handle many packets at once, we could have everyone
19
//send their BOM reading for a particular robot right after getting it.
20

  
21 18
/*Ring States*/
22 19

  
23 20
#define NONMEMBER 0
......
168 165
			WL_DEBUG_PRINT_INT(wl_token_next_robot);
169 166
			WL_DEBUG_PRINT(" has died.\r\n");
170 167
		}
171
		wl_token_pass_token();
168
		
169
		// we may have been dropped from the ring when this is received
170
		if (ringState == MEMBER)
171
			wl_token_pass_token();
172 172
	}
173 173

  
174 174
	//we must start our own token ring, no one is responding to us
......
377 377

  
378 378
			if (i == wl_get_xbee_id() && ringState == MEMBER)
379 379
			{
380
				sensor_matrix_set_in_ring(sensorMatrix,
381
						wl_get_xbee_id(), 1);
382 380
				ringState = NONMEMBER;
383 381
				wl_token_ring_join();
384 382
				
......
535 533
		{
536 534
			WL_DEBUG_PRINT("We should have left the token ring, but didn't.\r\n");
537 535
		}
536
		return;
538 537
	}
539 538
	
540 539
	//check for interruption requests

Also available in: Unified diff