Index: branches/init_refactor/code/behaviors/BOM_test/beaconBot/main.c
===================================================================
--- branches/init_refactor/code/behaviors/BOM_test/beaconBot/main.c	(revision 1517)
+++ branches/init_refactor/code/behaviors/BOM_test/beaconBot/main.c	(revision 1518)
@@ -3,29 +3,29 @@
 int main(void)
 {
 
-	/* initialize components, set wireless channel */
-	if (dragonfly_init(ANALOG|ORB|BOM) != 0) {
+  /* initialize components, set wireless channel */
+  if (dragonfly_init(/* ANALOG|ORB|BOM */ ALL_ON) != 0) {
     orbs_set_color(YELLOW, YELLOW);
     while(1) { ; }
   }
 
-	if (bom_on() != 0) {
+  if (bom_on() != 0) {
     orbs_set_color(RED, RED);
     while(1) { ; }
   }
   
 	
-	while (1) {
+  while (1) {
 
-		orbs_set_color(GREEN, BLUE);
+    orbs_set_color(GREEN, BLUE);
 
-		delay_ms(1000);
+    delay_ms(1000);
 
-		orbs_set_color(BLUE, GREEN);
+    orbs_set_color(BLUE, GREEN);
 
-		delay_ms(1000);
+    delay_ms(1000);
 
-	}
+  }
 
-	return 0;
+  return 0;
 }
Index: branches/init_refactor/code/lib/include/libwireless/wl_defs.h
===================================================================
--- branches/init_refactor/code/lib/include/libwireless/wl_defs.h	(revision 1517)
+++ branches/init_refactor/code/lib/include/libwireless/wl_defs.h	(revision 1518)
@@ -42,6 +42,14 @@
 //uncomment this line for debug information
 //#define WL_DEBUG
 
+//return value definitions
+/** @brief Error code for init failure **/
+#define WL_ERROR_INIT_FAILED 1
+/** @brief Error code for duplicate init calls **/
+#define WL_ERROR_INIT_ALREADY_INITD 2
+/** @brief Error code for not calling init **/
+#define WL_ERROR_LIBRARY_NOT_INITD 3
+
 // Packet Groups and Types
 
 // Error group
Index: branches/init_refactor/code/lib/include/libdragonfly/dragonfly_lib.h
===================================================================
--- branches/init_refactor/code/lib/include/libdragonfly/dragonfly_lib.h	(revision 1517)
+++ branches/init_refactor/code/lib/include/libdragonfly/dragonfly_lib.h	(revision 1518)
@@ -42,7 +42,7 @@
  **/
 
 /** @brief Initialize the board **/
-void dragonfly_init(int config);
+int dragonfly_init(int config);
 
 /** @} **/ //end addtogroup
 
Index: branches/init_refactor/code/lib/include/libdragonfly/dragonfly_defs.h
===================================================================
--- branches/init_refactor/code/lib/include/libdragonfly/dragonfly_defs.h	(revision 1517)
+++ branches/init_refactor/code/lib/include/libdragonfly/dragonfly_defs.h	(revision 1518)
@@ -90,4 +90,14 @@
 #define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
 
 
-#endif
\ No newline at end of file
+#ifdef DRAGONFLY_DEBUG
+#define DRAGONFLY_DEBUG_PRINT(s) usb_puts(s)
+#define DRAGONFLY_DEBUG_PRINTLN(s) usb_puts(__FILE__ ":" __LINE__ ">>" s "\r\n")
+#define DRAGONFLY_DEBUG_PRINT_INT(i) usb_puti(i)
+#else
+#define DRAGONFLY_DEBUG_PRINT(s)
+#define DRAGONFLY_DEBUG_PRINTLN(s)
+#define DRAGONFLY_DEBUG_PRINT_INT(i)
+#endif
+
+#endif
Index: branches/init_refactor/code/lib/bin/libwireless.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: branches/init_refactor/code/lib/bin/libdragonfly.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: branches/init_refactor/code/projects/libdragonfly/dragonfly_lib.c
===================================================================
--- branches/init_refactor/code/projects/libdragonfly/dragonfly_lib.c	(revision 1517)
+++ branches/init_refactor/code/projects/libdragonfly/dragonfly_lib.c	(revision 1518)
@@ -67,13 +67,16 @@
 
 int dragonfly_init(int config) 
 {
+  int ret = 0;
+
     sei();
     // Set directionality of various IO pins
     DDRG &= ~(_BV(PING0)|_BV(PING1));
     PORTG |= _BV(PING0)|_BV(PING1);
     
-    if(config & ANALOG)
-        analog_init(ADC_START);
+    if(config & ANALOG) {
+      analog_init(ADC_START);
+    }
     
     if(config & COMM)
     {
@@ -116,10 +119,10 @@
             return ERROR_INIT_FAILED;
     }
 
-	if (config & ENCODERS)
-	{
-		encoders_init();
-	}
+    if (config & ENCODERS)
+    {
+        encoders_init();
+    }
 
     // delay a bit for stability
     _delay_ms(1);
Index: branches/init_refactor/code/projects/libdragonfly/Makefile
===================================================================
--- branches/init_refactor/code/projects/libdragonfly/Makefile	(revision 1517)
+++ branches/init_refactor/code/projects/libdragonfly/Makefile	(revision 1518)
@@ -151,7 +151,7 @@
 
 # Combine all necessary flags and optional flags.
 # Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) $(GLOBAL_CFLAGS)
 ALL_ASFLAGS = rcs
 
 # Default target.
@@ -159,6 +159,13 @@
 
 dist: all publish
 
+debug_dist: ALL_CFLAGS += -DDRAGONFLY_DEBUG
+debug_dist: test all publish
+
+test:
+	echo "~~~~~~~ $(ALL_CFLAGS)"
+
+
 publish:
 	$(COPY) $(TARGET).a $(COLONYROOT)/code/lib/bin
 	$(COPY) *.h $(COLONYROOT)/code/lib/include/$(TARGET)
Index: branches/init_refactor/code/projects/libdragonfly/bom.c
===================================================================
--- branches/init_refactor/code/projects/libdragonfly/bom.c	(revision 1517)
+++ branches/init_refactor/code/projects/libdragonfly/bom.c	(revision 1518)
@@ -32,8 +32,7 @@
  *
  * @author Colony Project, CMU Robotics Club
  **/
-
-//#include "dragonfly_defs.h"
+#include "dragonfly_defs.h"
 #include "bom.h"
 #include "dio.h"
 #include "serial.h"
Index: branches/init_refactor/code/projects/libdragonfly/dragonfly_defs.h
===================================================================
--- branches/init_refactor/code/projects/libdragonfly/dragonfly_defs.h	(revision 1517)
+++ branches/init_refactor/code/projects/libdragonfly/dragonfly_defs.h	(revision 1518)
@@ -90,4 +90,14 @@
 #define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0)
 
 
-#endif
\ No newline at end of file
+#ifdef DRAGONFLY_DEBUG
+#define DRAGONFLY_DEBUG_PRINT(s) usb_puts(s)
+#define DRAGONFLY_DEBUG_PRINTLN(s) usb_puts(__FILE__ ":" __LINE__ ">>" s "\r\n")
+#define DRAGONFLY_DEBUG_PRINT_INT(i) usb_puti(i)
+#else
+#define DRAGONFLY_DEBUG_PRINT(s)
+#define DRAGONFLY_DEBUG_PRINTLN(s)
+#define DRAGONFLY_DEBUG_PRINT_INT(i)
+#endif
+
+#endif
Index: branches/init_refactor/code/Makefile
===================================================================
--- branches/init_refactor/code/Makefile	(revision 1517)
+++ branches/init_refactor/code/Makefile	(revision 1518)
@@ -40,9 +40,11 @@
 # make program = Download the hex file to the device, using avrdude.
 #                Please customize the avrdude settings below first!
 #
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make avrdebug = Start either simulavr or avarice as specified for debugging,
 #              with avr-gdb or avr-insight as the front end for debugging.
 #
+# make debug = recompile the library with debug flags
+#
 # make library = Build the library, then make software
 #
 # make filename.s = Just compile filename.c into the assembler code only.
@@ -92,7 +94,7 @@
 #     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
 #     AVR Studio 4.10 requires dwarf-2.
 #     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
-DEBUG =
+AVRDEBUG =
 
 # Compiler flag to set the C Standard level.
 #     c89   = "ANSI" C
@@ -124,7 +126,7 @@
 #  -Wa,...:      tell GCC to pass this to the assembler.
 #    -adhlns...: create assembler listing
 CFLAGS =
-# CFLAGS = -g$(DEBUG)
+# CFLAGS = -g$(AVRDEBUG)
 CFLAGS += $(CDEFS) $(CINCS)
 CFLAGS += -O$(OPT)
 CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
@@ -315,7 +317,7 @@
 
 # Combine all necessary flags and optional flags.
 # Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) $(GLOBAL_CFLAGS)
 ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 
 
@@ -378,12 +380,27 @@
 	$(AVRMEM) 2>/dev/null; echo; fi
 
 
+# debug flags
+debug: ALL_CFLAGS += -DDRAGONFLY_DEBUG
+debug: test debug_library  build  checksize 
 
+test:
+	echo "$(ALL_CFLAGS)"
+
+
+# Build the library
+debug_library:
+	@echo $(MSG_LIBRARY_BUILD)
+	make clean -C $(COLONYROOT)/code/projects/libdragonfly
+	make debug_dist -C $(COLONYROOT)/code/projects/libdragonfly
+	make clean -C $(COLONYROOT)/code/projects/libwireless/lib
+	make dist -C $(COLONYROOT)/code/projects/libwireless/lib
+
 # Display compiler version information.
 gccversion :
 	@$(CC) --version
-  
-  
+
+
 # Build the library
 library:
 	@echo $(MSG_LIBRARY_BUILD)
@@ -419,7 +436,7 @@
 endif
 	@echo break main >> $(GDBINIT_FILE)
 
-debug: gdb-config $(TARGET).elf
+avrdebug: gdb-config $(TARGET).elf
 ifeq ($(DEBUG_BACKEND), avarice)
 	@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
 	@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
