Project

General

Profile

Revision 1617

wl: clean up unit tests

View differences:

test_xbee.c
3 3

  
4 4
#define ROBOT
5 5
#define WL_DEBUG
6
#define WL_DEBUG_PRINT( s ) usb_puts( S )
7 6

  
8
extern int xbee_send_read_at_command(char* command);
9
extern int xbee_get_packet(unsigned char* dest);
10
extern void xbee_terminate(void);
11

  
12 7
/*
13 8
 * This function tests the xbee, returning the results to teraterm
14 9
 *
......
23 18
	usb_init();
24 19
	usb_puts("usb turned on, test starting:\r\n");
25 20
  
26
  if (xbee_lib_init() != 0) {
27
    usb_puts("xbee_lib_init() failed\r\n");
21
  if (xbee_init() != 0) {
22
    usb_puts("xbee_init() failed\r\n");
28 23
    return -1;
29 24
  } else {
30
    usb_puts("xbee_lib__init successful\r\n");
25
    usb_puts("xbee_init successful\r\n");
31 26
  }
32 27
 
33 28
	usb_puts("\r\n\n");
......
37 32
  
38 33
	
39 34
	// try getting xbee address
40
  xbee_send_read_at_command("MY");
35
  /*xbee_send_read_at_command("MY");
41 36
  while(i++ < 10000) {
42 37
    if(xbee_get_packet(buf) == 3) {
43 38
      usb_puts("got response from xbee\r\n");
......
46 41
      //usb_puts("|end\r\n");
47 42
      break; // got a response
48 43
    }
49
  }
44
  }*/
50 45
  
51 46
  // try setting channel
52 47
  /*xbee_set_channel(0x0F);
......
86 81
  usb_puts("\r\nwireless set channel works\r\n");*/
87 82
  
88 83
  // scan all xbees in network
89
  xbee_send_read_at_command("ND");
84
  /*xbee_send_read_at_command("ND");
90 85
  i=0;
91 86
  while(i < 1000) {
92 87
    if(xbee_get_packet(buf) == 3) {
93 88
      usb_puts("got response from xbee\r\n");
94 89
      i++;
95 90
    }
96
  }
91
  }*/
97 92
  
98 93
  // end of tests
99
  xbee_terminate();
94
  if (xbee_terminate() != 0) {
95
    usb_puts("xbee_terminate error\r\n");
96
  } else {
97
    usb_puts("xbee_terminate success\r\n");
98
  }
100 99
  usb_puts("testxbee done\r\n\r\n");
101 100
    
102 101
	return 0;
103
}
102
}

Also available in: Unified diff