Dependencies:   mbed

Dependents:   HvZ

Revision:
1:eefaa22e4b2c
Parent:
0:86ff0a55c978
Child:
2:2a826741387f
--- a/XBee.hpp	Tue Nov 30 21:28:18 2010 +0000
+++ b/XBee.hpp	Wed Dec 01 21:14:23 2010 +0000
@@ -122,6 +122,18 @@
         if (source_idx == string::npos ||
             dest_idx   == string::npos ||
             data_idx   == string::npos) return false;
+        
+        #if _XBEE_DEBUG > 1
+        Serial usb(USBTX,USBRX);
+        usb.printf("-- UNPACK:\r\n");
+        usb.printf("-- FULL    = %s\r\n", m_data.c_str());
+        usb.printf("-- INDICES = src %d / dst %d / dat %d\r\n", source_idx, dest_idx, data_idx);
+        usb.printf("-- SPLIT   = %s / %s / %s\r\n",
+          m_data.substr(source_idx, dest_idx - source_idx - 1).c_str(),
+          m_data.substr(dest_idx, data_idx - dest_idx - 1).c_str(),
+          m_data.substr(data_idx));
+        #endif
+        
         m_source = m_data.substr(source_idx, dest_idx - source_idx - 1);
         m_dest   = m_data.substr(dest_idx, data_idx - dest_idx - 1);
         m_data   = m_data.substr(data_idx);
@@ -198,7 +210,10 @@
       m_resetn(xbee_rst), m_ison(xbee_on), m_comm(xbee_din, xbee_dout),
       m_usb(USBTX, USBRX), m_read_handler(NULL)
     {
+        #if _XBEE_DEBUG > 0
         m_usb.printf("Resetting XBee...\r\n");
+        #endif
+        
         // Reset the XBEE module
         m_resetn = 0;
         wait(.1);
@@ -212,7 +227,9 @@
         m_comm.attach(this, &XBee::rxirq);
         
         // Check sleep status
+        #if _XBEE_DEBUG > 0
         m_usb.printf("XBee is %s\r\n", (m_ison)?"ON":"SLEEP");
+        #endif
         
         setup();
     }