Index: branches/autonomous_recharging/code/lib/bin/libwireless.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/xbee.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/xbee.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/xbee.c	(revision 116)
@@ -165,7 +165,9 @@
 		exit(0);
 	}
 	#endif
+	usb_puts("Entering command mode.\n");
 	xbee_enter_command_mode();
+	usb_puts("Entered command mode.\n");
 	xbee_enter_api_mode();
 	xbee_exit_command_mode();
 	xbee_send_read_at_command("MY");
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/charging_defs.h
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/charging_defs.h	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/charging_defs.h	(revision 116)
@@ -12,8 +12,10 @@
 
 #ifdef STATION_DEBUG
 #define STATION_DEBUG_PRINT( s ) usb_puts( s )
+#define STATION_DEBUG_PUTI( i ) usb_puti( i )
 #else
 #define STATION_DEBUG_PRINT( s )
+#define STATION_DEBUG_PUTI( i )
 #endif
 
 /**
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/Makefile
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/Makefile	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/Makefile	(revision 116)
@@ -202,7 +202,7 @@
 AVRDUDE_PROGRAMMER = avrisp
 
 # com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = /dev/ttyUSB0
+AVRDUDE_PORT = /dev/ttyUSB1
 # programmer connected to serial device
 
 AVRDUDE_WRITE_FLASH = -b 9600 -U flash:w:$(TARGET).hex
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/bays.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/bays.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/bays.c	(revision 116)
@@ -1,57 +1,8 @@
 #include "firefly+_lib.h"
 #include "bays.h"
 
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
-
-void bay_tester(void)
-{
-    bayStates[1] = 50;
-    bayStates[2] = 51;
-    bayStates[3] = 52;
-}
-
-void print_bays_debug(void)
-{
-
-	usb_puts("\n\r");
-	usb_puts("Bays: ");
-	for(int i = 0; i < NUM_BAYS; i++) {
-		usb_puti(bayStates[i]);
-		usb_putc(' ');
-	}
-	usb_puts("\n\r");
-	
-	usb_puts("Seeking robot: ");
-	usb_puti(robot_seeking);
-	usb_puts("\n\r");
-}
-
-void do_consistency_checks(void)
-{
-    if(robot_seeking != 255 && robot_assignment(robot_seeking) == 255) // the only free bay from bay_tester()
-    {
-      usb_puts("BAD STUFF HAPPENED...\n\r");
-      usb_puts("robot assigned to BAY 1 does not equal robot_seeking\n\r");
-      usb_puts("\n\rrobot_seeking: ");
-      usb_puti(robot_seeking);
-      usb_puts("Bay 1 contains:  ");
-      usb_puti(bayStates[1]);
-      usb_puts("\n\r");
-      //while(1);
-    }
-}
-// END DEBUGGING FUNCTIONS
-
 void bays_init(void)
 {
-	int i;
-	for (i = 0; i < NUM_BAYS; i++)
-		bayStates[i] = 255;
-	robot_seeking = 255;
-	bay_tester();
-	
 	digital_output(ENABLE_PIN, 0);
 	digital_output(BOM_PIN, 1);
 	digital_output(SELECT_0, 0);
@@ -61,137 +12,6 @@
 	active_bay = -1;
 }
 
-/*int assign_bay(int robot)
-{
-	int max_bom = sensors[robot]; // where the station sees the robot (max bom)
-	int closest = 255;
-	int distance = 16;
-	int i;
-	for (i = 0; i < NUM_BAYS; i++)
-	{
-		if (bayStates[i] != 255)
-			continue;
-		int d = max_bom - i * 4; // distance (BOM-wise) from bay
-		if (d < -8)
-			d += 16;
-		else
-			if (d > 8)
-				d -= 16;
-		if (d < 0)
-			d *= -1;
-		if (d < distance) // finds closest bay to robot's current position
-		{
-			distance = d; // distance (BOM-wise)
-			closest = i; // actual bay number
-		}
-	}
-	if (closest == 255) // all full
-		return 255;
-	bayStates[closest] = robot;
-	return closest;
-}*/
-
-/*int assign_bay(int robot) // returns number of an empty bay (255 if all full)
-{
-    for(int i = 0; i < NUM_BAYS; i++) // right now, go thru linearly and allocate first available bay
-    {
-        if(bayStates[i] == 255)
-        {
-            bayStates[i] = robot;
-            return i;
-        }
-    }
-}*/
-
-int left_index( int pos )
-{
-	int i;
-	for(i = pos; i >= 0; i--)
-	{
-		if(bayStates[i] != 255)
-			return i;
-	}
-	return -1;
-}
-
-int right_index( int pos )
-{
-	int i;
-	for(i = pos; i < NUM_BAYS; i++)
-	{
-		if(bayStates[i] != 255)
-			return i;
-	}
-	return NUM_BAYS;
-}
-
-/*int assign_bay( int robot ) // 'smart' assign_bay()
-{
-	int ldist = 0;
-	int rdist = 0;
-	int score = 0;
-	int max = 0;
-	
-	int bay = 255;
-	
-	int count = 0;
-	
-	int i;
-	for(i = 0; i < NUM_BAYS; i++)
-	{
-		if(bayStates[i] == 255)
-			count++;
-	}
-	if(count == NUM_BAYS)
-	{
-		bayStates[0] = robot;
-		return 0;
-	}
-	
-	for(i = 0; i < NUM_BAYS; i++)
-	{
-		if(bayStates[i] == 255)
-		{
-			ldist = i - left_index(i);
-			rdist = right_index(i) - i;
-			if(ldist - i == 1)
-				score = rdist;
-			else if(i + rdist == NUM_BAYS)
-				score = ldist;
-			else
-				score = MIN(ldist,rdist);
-			if(score > max)
-			{
-				max = score;
-				bay = i;
-			}
-		}
-		ldist = rdist = 0;
-	}
-	bayStates[bay] = robot;
-	return bay;
-}*/
-
-int robot_assignment(int robot) //returns bay to which 'robot' has been assigned, 255 if not yet assigned
-{
-    for(int i = 0; i < NUM_BAYS; i++)
-    {
-        if(bayStates[i] == robot)
-            return i;
-    }
-    return 255;
-}
-
-int is_empty(void) //returns 1 if there is an empty bay, 0 if not
-{
-    for(int i = 0; i < NUM_BAYS; i++)
-    {
-        if(bayStates[i] == 255)
-            return 1;
-    }
-    return 0;
-}
-
 void lbom_on(void)
 {
 	digital_output(BOM_PIN, 0);
@@ -217,3 +37,4 @@
 {
 	digital_output(ENABLE_PIN, 0);
 }
+
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/bays.h
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/bays.h	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/bays.h	(revision 116)
@@ -7,27 +7,10 @@
 #define SELECT_1	_PIN_A3
 #define SELECT_2	_PIN_A4
 
-#define NUM_BAYS 4
-
-#define MAX_ROBOTS 20
-char sensors[MAX_ROBOTS]; //from wl_charging_station...probably should be there instead of here, but assign_bay needs for now
-
-int bayStates[NUM_BAYS]; //holds robot id of robot in each bay 0-3 (255 if empty)
-int robot_seeking; //robot if of the robot currently seeking (255 if none)
-
 int active_bay;
 
-void bay_tester(void);
-void print_bays_debug(void);
-void do_consistency_checks(void);
-
+// bom & beacon functions
 void bays_init(void);
-
-int assign_bay(int robot);
-int robot_assignment(int robot);
-int is_empty(void);
-
-// bom & beacon functions
 void lbom_on(void);
 void lbom_off(void);
 void bay_enable(int which);
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/charging.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/charging.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/charging.c	(revision 116)
@@ -1,5 +1,6 @@
 #include "charging.h"
 #include "charging_defs.h"
+#include "bays.h"
 
 #include <stdlib.h>
 #include <serial.h>
@@ -53,6 +54,8 @@
 	for (i = 0; i < NUM_BAYS; i++)
 		bays[i] = -1;
 
+	bays_init();
+
 	// call our own special function to set the BOM
 	wl_token_ring_set_bom_functions(charging_bom_on,
 		charging_bom_off, charging_bom_read);
@@ -169,10 +172,14 @@
 		return;
 	}
 
+	STATION_DEBUG_PRINT("Cancelling charging for robot ");
+	STATION_DEBUG_PUTI(robot);
+	STATION_DEBUG_PRINT(".\n");
+
 	//allow other robots to seek
 	if (robots[robot]->state == STATE_SEEKING)
 	{
-		//TODO : deactivate BOMs and homing beacons
+		bay_disable();
 		is_seeking = 0;
 	}
 
@@ -195,8 +202,17 @@
 {
 	int bay = 0;
 
-	//TODO: implement
+	//TODO: use better algorithm based on distance
+	for (bay = 0; bay < NUM_BAYS; bay++)
+		if (bays[bay] == -1)
+			break;
 
+	if (bay == NUM_BAYS)
+	{
+		STATION_DEBUG_PRINT("Attempted to assign a bay when all ");
+		STATION_DEBUG_PRINT("are full.\n");
+	}
+
 	bays[bay] = robot;
 	return bay;
 }
@@ -208,6 +224,10 @@
  **/
 void charging_begin_seeking(int robot)
 {
+	STATION_DEBUG_PRINT("Robot ");
+	STATION_DEBUG_PUTI(robot);
+	STATION_DEBUG_PRINT(" has begun seeking.\n");
+	
 	if (robot > robotsSize)
 	{
 		int nextSize = robot + 1;
@@ -244,9 +264,17 @@
 				STATION_DEBUG_PRINT("seeking.\n");
 				break;
 			case STATE_DOCKED:
+				if (is_seeking)
+				{
+					//we can only allow one robot to seek
+					robots[robot]->state = STATE_NOT_CHARGING;
+					bays[robots[robot]->bay] = -1;
+					robots[robot]->bay = -1;
+					break;
+				}
 				robots[robot]->state = STATE_SEEKING;
 				is_seeking = 1;
-				//TODO: active robots[robot]->bay
+				bay_enable(robots[robot]->bay);
 				break;
 			default:
 				STATION_DEBUG_PRINT("Robot is in an ");
@@ -275,7 +303,7 @@
 	robots[robot] = r;
 	numRobots++;
 	is_seeking = 1;
-	//TODO: activate r->bay
+	bay_enable(r->bay);
 }
 
 /**
@@ -285,6 +313,10 @@
  **/
 void charging_dock(int robot)
 {
+	STATION_DEBUG_PRINT("Robot ");
+	STATION_DEBUG_PUTI(robot);
+	STATION_DEBUG_PRINT(" has docked with the station.\n");
+
 	if (robots[robot] == NULL)
 	{
 		STATION_DEBUG_PRINT("Should not proceed from not ");
@@ -300,7 +332,7 @@
 
 	//robot was seeking before
 	is_seeking = 0;
-	//TODO: deactivate boms and homing beacons
+	bay_disable();
 	robots[robot]->state = STATE_DOCKED;
 }
 
@@ -351,7 +383,7 @@
  **/
 void charging_bom_on(void)
 {
-	//TODO: implement
+	lbom_on();
 }
 
 /**
@@ -360,7 +392,7 @@
  **/
 void charging_bom_off(void)
 {
-	//TODO: implement
+	lbom_off();
 }
 
 /**
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/main.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/main.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/charging_station/main.c	(revision 116)
@@ -16,10 +16,13 @@
 	
 	//dragonfly_init(ALL_ON);
 
+	usb_puts("Initializing wireless.\n");
 	wl_init();
 	wl_token_ring_register();
 	charging_init();
 
+	usb_puts("Charging station initialized.\n");
+
 	while (1)
 		wl_do();
 
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/wl_recharge_group.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/wl_recharge_group.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/wl_recharge_group.c	(revision 116)
@@ -2,10 +2,11 @@
 
 #include <wireless.h>
 #include <wl_defs.h>
-#include <stdio.h>
-#include <string.h>
 
+#include <serial.h>
 
+#include "recharge_defs.h"
+
 // Function prototypes
 void wl_recharge_timeout_handler(void);
 void wl_recharge_response_handler(int frame, int received);
@@ -59,6 +60,7 @@
 int requestCount = 0;
 int verifyCount = 0;
 
+
 /**
  * Register this packet group with the wireless library.
  * This function must be called before any other wl_recharge
@@ -111,7 +113,7 @@
 {
 	if (recharge_state != SEEKING)
 	{
-		WL_DEBUG_PRINT("Unexpected docking occurred.\n");
+		RECHARGE_DEBUG_PRINT("Unexpected docking occurred.\n");
 		return;
 	}
 
@@ -126,7 +128,7 @@
 {
 	if (recharge_state != DOCKED)
 	{
-		WL_DEBUG_PRINT("Unexpected departure occurred.\n");
+		RECHARGE_DEBUG_PRINT("Unexpected departure occurred.\n");
 		return;
 	}
 	
@@ -163,7 +165,7 @@
 void wl_recharge_send_poll(void)
 {
 	wl_send_global_packet(WL_RECHARGE_GROUP, WL_RECHARGE_POLL_STATIONS,
-				NULL, 0, 0);
+				0, 0, 0);
 }
 
 /**
@@ -174,7 +176,7 @@
 void wl_recharge_send_request(int dest)
 {
 	wl_send_robot_to_robot_global_packet(WL_RECHARGE_GROUP, WL_RECHARGE_REQUEST,
-				NULL, 0, dest, REQUEST_FRAME);
+				0, 0, dest, REQUEST_FRAME);
 }
 
 /**
@@ -186,7 +188,7 @@
 void wl_recharge_send_verify(int dest)
 {
 	wl_send_robot_to_robot_global_packet(WL_RECHARGE_GROUP, WL_RECHARGE_VERIFY,
-				NULL, 0, dest, VERIFY_FRAME);
+				0, 0, dest, VERIFY_FRAME);
 }
 
 /**
@@ -196,7 +198,7 @@
 void wl_recharge_send_cancel(int dest)
 {
 	wl_send_robot_to_robot_global_packet(WL_RECHARGE_GROUP, WL_RECHARGE_CANCEL,
-				NULL, 0, dest, CANCEL_FRAME);
+				0, 0, dest, CANCEL_FRAME);
 }
 
 /**
@@ -208,7 +210,7 @@
 void wl_recharge_send_seeking(int dest)
 {
 	wl_send_robot_to_robot_global_packet(WL_RECHARGE_GROUP, WL_RECHARGE_SEEKING,
-				NULL, 0, dest, SEEKING_FRAME);
+				0, 0, dest, SEEKING_FRAME);
 }
 
 /**
@@ -220,7 +222,7 @@
 void wl_recharge_send_docked(int dest)
 {
 	wl_send_robot_to_robot_global_packet(WL_RECHARGE_GROUP, WL_RECHARGE_DOCKED,
-				NULL, 0, dest, DOCKED_FRAME);
+				0, 0, dest, DOCKED_FRAME);
 }
 
 /**
@@ -288,7 +290,7 @@
 		return;
 	if (!received)
 	{
-		WL_DEBUG_PRINT("Sent packet not recieved.\n");
+		RECHARGE_DEBUG_PRINT("Sent packet not recieved.\n");
 		switch (frame)
 		{
 			case REQUEST_FRAME:
@@ -323,7 +325,7 @@
 			wl_recharge_available_station(source);
 			break;
 		case WL_RECHARGE_REQUEST:
-			WL_DEBUG_PRINT("Only stations should receive WL_RECHARGE_REQUEST.\n");
+			RECHARGE_DEBUG_PRINT("Only stations should receive WL_RECHARGE_REQUEST.\n");
 			break;
 		case WL_RECHARGE_REQUEST_ACCEPT:
 			wl_recharge_request_accepted(source);
@@ -341,7 +343,7 @@
 			wl_recharge_docked(source);
 			break;
 		default:
-			WL_DEBUG_PRINT("Error packet of unknown type received.\n");
+			RECHARGE_DEBUG_PRINT("Error packet of unknown type received.\n");
 			break;
 	}
 }
@@ -372,12 +374,12 @@
 {
 	if (recharge_state != REQUESTING)
 	{
-		WL_DEBUG_PRINT("Accepted when we weren't requesting.\n");
+		RECHARGE_DEBUG_PRINT("Accepted when we weren't requesting.\n");
 		return;
 	}
 	if (station != source)
 	{
-		WL_DEBUG_PRINT("Accepted by a different station.\n");
+		RECHARGE_DEBUG_PRINT("Accepted by a different station.\n");
 		return;
 	}
 
@@ -395,7 +397,7 @@
 {
 	if (source != station)
 	{
-		WL_DEBUG_PRINT("Received verify from unassociated station.\n");
+		RECHARGE_DEBUG_PRINT("Received verify from unassociated station.\n");
 		wl_recharge_send_cancel(source);
 		return;
 	}
@@ -409,7 +411,7 @@
 			wl_recharge_send_docked(station);
 			break;
 		default:
-			WL_DEBUG_PRINT("Cancelled docking procedure.\n");
+			RECHARGE_DEBUG_PRINT("Cancelled docking procedure.\n");
 			wl_recharge_send_cancel(station);
 			break;
 	}
@@ -425,7 +427,7 @@
 {
 	if (station != source)
 	{
-		WL_DEBUG_PRINT("Received cancel from station we weren't docking with.\n");
+		RECHARGE_DEBUG_PRINT("Received cancel from station we weren't docking with.\n");
 		return;
 	}
 
@@ -441,7 +443,7 @@
 			recharge_state = POLLING;
 			break;
 		case DOCKED:
-			WL_DEBUG_PRINT("Charging station kicked us out.\n");
+			RECHARGE_DEBUG_PRINT("Charging station kicked us out.\n");
 			wl_recharge_depart();
 			break;
 		case DEPARTING:
@@ -448,7 +450,7 @@
 			//ignore, since we are already departing
 			break;
 		default:
-			WL_DEBUG_PRINT("Received unexpected cancellation.\n");
+			RECHARGE_DEBUG_PRINT("Received unexpected cancellation.\n");
 			break;
 	}
 }
@@ -463,7 +465,7 @@
 {
 	if (station != source)
 	{
-		WL_DEBUG_PRINT("Received seeking alert from station we aren't seeking.\n");
+		RECHARGE_DEBUG_PRINT("Received seeking alert from station we aren't seeking.\n");
 		wl_recharge_send_cancel(source);
 		return;
 	}
@@ -478,7 +480,7 @@
 			wl_recharge_send_docked(station);
 			break;
 		default:
-			WL_DEBUG_PRINT("Received unexpected seeking confirmation.\n");
+			RECHARGE_DEBUG_PRINT("Received unexpected seeking confirmation.\n");
 			break;
 	}
 }
@@ -493,7 +495,7 @@
 {
 	if (station != source)
 	{
-		WL_DEBUG_PRINT("Unknown station believes we are docked.\n");
+		RECHARGE_DEBUG_PRINT("Unknown station believes we are docked.\n");
 		wl_recharge_send_cancel(source);
 		return;
 	}
@@ -507,13 +509,13 @@
 		case SEEKING:
 			//not good - we can't immediately proceed to seeking again
 			//we will leave the station and repoll it
-			WL_DEBUG_PRINT("Seeking, but station believes we are docked. ");
-			WL_DEBUG_PRINT("Leaving station and repolling.\n");
+			RECHARGE_DEBUG_PRINT("Seeking, but station believes we are docked. ");
+			RECHARGE_DEBUG_PRINT("Leaving station and repolling.\n");
 			wl_recharge_send_cancel(source);
 			wl_recharge_begin();
 			break;
 		default:
-			WL_DEBUG_PRINT("Unexpected docking verification received.\n");
+			RECHARGE_DEBUG_PRINT("Unexpected docking verification received.\n");
 			break;
 	}
 }
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/recharge.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/recharge.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/recharge.c	(revision 116)
@@ -1,11 +1,14 @@
 #include <move.h>
 #include <battery.h>
 #include <dio.h>
+#include <lights.h>
 
 #include <wl_defs.h>
 #include "wl_recharge_group.h"
 #include "seeking.h"
 #include "departing.h"
+#include "recharge_i2c.h"
+#include "recharge_defs.h"
 
 // Function prototypes
 void recharge_check_low_battery(void);
@@ -13,6 +16,11 @@
 void recharge_seek(void);
 void recharge_depart(void);
 
+//Global variables
+#ifdef RECHARGE_DEBUG
+int old_state = -1;
+#endif
+
 /**
  * Initializes recharging. Before this function may be called,
  * wl_init must be called.
@@ -75,9 +83,33 @@
 
 	// show colors if we are debugging
 	#ifdef RECHARGE_DEBUG
-	switch (wl_recharge_get_state())
+	if (old_state != wl_recharge_get_state())
 	{
-		
+		old_state = wl_recharge_get_state();
+		RECHARGE_DEBUG_PUTI(old_state);
+		switch (wl_recharge_get_state())
+		{
+			case NOT_RECHARGING:
+				orb_set_color(GREEN);
+				break;
+			case POLLING:
+			case REQUESTING:
+				orb_set_color(RED);
+				//we shouldn't be in this state
+				break;
+			case SEEKING:
+				orb_set_color(YELLOW);
+				break;
+			case DOCKED:
+				orb_set_color(BLUE);
+				break;
+			case DEPARTING:
+				orb_set_color(PURPLE);
+				break;
+			default:
+				WL_DEBUG_PRINT("Unexpected state.\n");
+				break;
+		}
 	}
 	#endif
 	
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/main.c
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/main.c	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/main.c	(revision 116)
@@ -1,8 +1,30 @@
 #include <dragonfly_lib.h>
+#include <wireless.h>
+#include <wl_token_ring.h>
 
+#include "recharge.h"
+
 int main(void)
 {
 	dragonfly_init(ALL_ON);
+	usb_puts("Initializing wireless.\n");
+	wl_init();
+	wl_token_ring_register();
+	wl_token_ring_join();
+	usb_puts("Wireless initialized.\n");
+	recharge_init();
+	usb_puts("Recharging initialized.\n");
+
+	while (1)
+	{
+		wl_do();
+		int charging = recharge_do();
+		if (!charging)
+		{
+			//do stuff
+		}
+	}
+	
 	return 0;
 }
 
Index: branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/Makefile
===================================================================
--- branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/Makefile	(revision 115)
+++ branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/Makefile	(revision 116)
@@ -4,7 +4,8 @@
 
 # Relative path to the root directory (containing lib directory)
 ifndef COLONYROOT
-COLONYROOT = ../../../..
+#COLONYROOT = ../../../..
+COLONYROOT = ../../../../../../trunk
 endif
 
 # Target file name (without extension).
@@ -14,7 +15,7 @@
  USE_WIRELESS = 1
 
 # com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = com4
+AVRDUDE_PORT = /dev/ttyUSB0
 #
 #
 ###################################
