Index: branches/ir_branch/code/tools/eeprom/program_eeprom.c
===================================================================
--- branches/ir_branch/code/tools/eeprom/program_eeprom.c	(revision 1571)
+++ branches/ir_branch/code/tools/eeprom/program_eeprom.c	(revision 1572)
@@ -1,10 +1,11 @@
 #include <dragonfly_lib.h>
+#include <stdlib.h>
 #include <eeprom.h>
 
 int main()
 {
   char str[5];
-  int i=0,id;
+  int i=0,id,ir_offset;
   char c;
 
   dragonfly_init(ALL_ON);
@@ -12,9 +13,16 @@
   usb_puts("Here is the current setup:\r\n  ID: ");
   itoa(get_robotid(), str, 10);
   usb_puts(str);
+  
   usb_puts("\r\n  BOM type: ");
   itoa(get_bom_type(), str, 10);
   usb_puts(str);
+  
+  usb_puts("\r\n  IR Offset: ");
+  itoa(get_ir_offset(), str, 10);
+  usb_puts(str);
+  
+  
   usb_puts("\r\n\r\nEnter new ID:");
 
   while((c = usb_getc()) != '\n' && c != '\r')
@@ -64,8 +72,30 @@
   eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+2, 'M');
   eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+3, id);
 
+  usb_puts("\r\n\r\nEnter new IR Offset:");
+  i = 0;
+  while((c = usb_getc()) != '\n' && c != '\r')
+    {
+      usb_putc(c);
+      if(i>=4)
+      {
+        usb_puts("ERROR: filled buffer\n");
+        while(1);
+      }
+      str[i++] = c;
+    }
+  while(i<5)
+    str[i++] = 0;
 
+  ir_offset = atoi(str);
 
+  usb_puts("\r\nsetting new IR_offset to: ");
+  usb_puti(ir_offset);
+  
+  eeprom_put_byte(EEPROM_IR_OFFSET_ADDR, 'I');
+  eeprom_put_byte(EEPROM_IR_OFFSET_ADDR+1, 'R');
+  eeprom_put_byte(EEPROM_IR_OFFSET_ADDR+2, ir_offset);
+
   usb_puts("\r\ndone! have a nice day\r\n");
 
 
Index: branches/ir_branch/code/lib/include/libdragonfly/eeprom.h
===================================================================
--- branches/ir_branch/code/lib/include/libdragonfly/eeprom.h	(revision 1571)
+++ branches/ir_branch/code/lib/include/libdragonfly/eeprom.h	(revision 1572)
@@ -12,6 +12,7 @@
  
  #define EEPROM_ROBOT_ID_ADDR 0x10
  #define EEPROM_BOM_TYPE_ADDR 0x14
+ #define EEPROM_IR_OFFSET_ADDR 0x20
  
  /** @brief store a byte to eeproem
   *  @return 0 if success, nonzero on failure
@@ -44,4 +45,13 @@
   */
  unsigned char get_bom_type(void);
  
+    /** @brief get stored robot ID
+  *
+  * checks that EEPROM has been programed with an BOM type and returns it
+  *
+  *  @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
+  */
+ unsigned char get_ir_offset(void);
+ 
+ 
  #endif
Index: branches/ir_branch/code/lib/bin/libwireless.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: branches/ir_branch/code/lib/bin/libdragonfly.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: branches/ir_branch/code/projects/libdragonfly/eeprom.c
===================================================================
--- branches/ir_branch/code/projects/libdragonfly/eeprom.c	(revision 1571)
+++ branches/ir_branch/code/projects/libdragonfly/eeprom.c	(revision 1572)
@@ -53,3 +53,16 @@
     else
         return 0xFF;
 }
+
+unsigned char get_ir_offset(void) {
+    unsigned char c0, c1, c2;
+    
+    eeprom_get_byte(EEPROM_IR_OFFSET_ADDR, &c0);
+    eeprom_get_byte(EEPROM_IR_OFFSET_ADDR+1, &c1);
+    eeprom_get_byte(EEPROM_IR_OFFSET_ADDR+2, &c2);
+    if(c0 == 'I' && c1 == 'R')
+        return c2;
+    else
+        return 0xFF;
+}
+
Index: branches/ir_branch/code/projects/libdragonfly/eeprom.h
===================================================================
--- branches/ir_branch/code/projects/libdragonfly/eeprom.h	(revision 1571)
+++ branches/ir_branch/code/projects/libdragonfly/eeprom.h	(revision 1572)
@@ -12,6 +12,7 @@
  
  #define EEPROM_ROBOT_ID_ADDR 0x10
  #define EEPROM_BOM_TYPE_ADDR 0x14
+ #define EEPROM_IR_OFFSET_ADDR 0x20
  
  /** @brief store a byte to eeproem
   *  @return 0 if success, nonzero on failure
@@ -44,4 +45,13 @@
   */
  unsigned char get_bom_type(void);
  
+    /** @brief get stored robot ID
+  *
+  * checks that EEPROM has been programed with an BOM type and returns it
+  *
+  *  @return the robot bom type as defined in bom.h, if it is stored. If it returns 0xFF it is probably invalid
+  */
+ unsigned char get_ir_offset(void);
+ 
+ 
  #endif
