Changeset - f1ded7817da7
[Not reviewed]
default
0 1 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-02-11 16:01:07
ethanzonca@CL-ENS241-08.cedarville.edu
Integrated XBEE communication timeout into node scan, added activity indicator when detecting.
1 file changed with 22 insertions and 7 deletions:
0 comments (0 inline, 0 general)
master/master/lib/slavesensors.c
Show inline comments
 
@@ -119,7 +119,14 @@ void slavesensors_network_scan()
 
		serial0_sendChar(0x0D);
 
		
 
		// wait for scan to complete
 
		uint16_t scanStart = time_millis(); 		
 
		uint32_t scanStart = time_millis();
 
		uint32_t lastBlink = 0;
 
		
 
		// Scan data end when newline by itself ("")	
 
		int lineCount = 0;	
 
	
 
		while(1) 
 
		{
 
		while(!serial0_hasChar()) 
 
		{
 
			if(time_millis() - scanStart > 7000) 
 
@@ -127,13 +134,15 @@ void slavesensors_network_scan()
 
				led_errorcode(ERROR_XBEETIMEOUT);
 
				return;
 
			}
 
				if(time_millis() - lastBlink > 50)
 
				{
 
					led_spin();
 
					
 
					lastBlink = time_millis();
 
				}
 
			wdt_reset();
 
		}
 
		// Scan data end when newline by itself ("")	
 
		int lineCount = 0;	
 
	
 
		while(1) 
 
		{
 
			bufPtr = serial0_readLine();
 

	
 
			// If we're starting a new block but got a newline instead, we're done!
 
@@ -173,7 +182,13 @@ void slavesensors_network_scan()
 

	
 
	}
 
	
 

	
 
	// Display number of found nodes on spinning indicator
 
	led_off(LED_ACT0);
 
	led_off(LED_ACT1);
 
	led_off(LED_ACT2);
 
	led_off(LED_ACT3);
 
	
 
	switch(nodeCount) 
 
	{
 
		case 0:
 
@@ -188,9 +203,9 @@ void slavesensors_network_scan()
 
			led_on(LED_ACT0);
 
			_delay_ms(100);
 
	}
 
	>
 
	_delay_ms(500);
 
	led_on(LED_SIDEBOARD);
 
	_delay_ms(200);
 
	_delay_ms(500);
 
	led_off(LED_SIDEBOARD);
 

	
 
	#ifdef DEBUG_OUTPUT
0 comments (0 inline, 0 general)