Project

General

Profile

Revision 1269

Improved robot sensor dump format

View differences:

dump_robot.c
15 15
	while (usb_getc_nb (&c)==-1)
16 16
	{
17 17
		robot_read_encoders (&left, &right);
18
		usb_puti (left);
19
		usb_puts (" ");
20
		usb_puti (right);
21
		usb_puts (NL);
18
		
19
		usb_puts ("Left:  "); usb_puti (left ); usb_puts (NL);
20
		usb_puts ("Right: "); usb_puti (right); usb_puts (NL);
21
		usb_puts (NL NL);
22 22
	}
23 23
}
24 24

  
25 25
void dump_robot_rangefinders (void)
26 26
{
27
	uint16_t rf;
27
	uint16_t rf[5];
28 28
	char c;
29 29

  
30 30
	while (usb_getc_nb (&c)==-1)
31 31
	{
32
		// First read all of the values, then print them, because it's much more readable that way.
33

  
32 34
		for (uint8_t i=0; i<5; ++i)
33 35
		{
34
			robot_read_rangefinder (i, &rf);
35
			if (i!=0) usb_puts (" ");
36
			usb_puti (rf);
36
			robot_read_rangefinder (i, &rf[i]);
37 37
		}
38
		usb_puts (NL);
38

  
39
		for (uint8_t i=0; i<5; ++i)
40
		{
41
			usb_puti (i);
42
			usb_puts (": ");
43
			usb_puti (rf[i]);
44
			usb_puts (NL);
45
		}
46

  
47
		usb_puts (NL NL);
39 48
	}
40 49
}
41 50

  
42 51
void dump_robot_bom (void)
43 52
{
44
	uint16_t bom;
53
	uint16_t bom[16];
45 54
	char c;
46

  
55
	
47 56
	while (usb_getc_nb (&c)==-1)
48 57
	{
58
		// First read all of the values, then print them, because it's much more readable that way.
59
		
49 60
		for (uint8_t i=0; i<16; ++i)
61
			robot_read_rangefinder (i, &bom[i]);
62

  
63
		for (uint8_t i=0; i<16; ++i)
50 64
		{
51
			robot_read_rangefinder (i, &bom);
52
			if (i!=0) usb_puts (" ");
53
			usb_puti (bom);
65
			if (i<10) usb_puts (" ");
66
			usb_puti (i);
67
			usb_puts (": ");
68
			usb_puti (bom[i]);
69
			usb_puts (NL);
54 70
		}
55
		usb_puts (NL);
71
		usb_puts (NL NL);
56 72
	}
57 73
}

Also available in: Unified diff