Revision 883
Wireless for bayboard sort of works. I still left in all my debugging information though, and it doesn't seem to work quite as well as the other two. Some more work is needed.
sensor_matrix.c | ||
---|---|---|
55 | 55 |
for (i = 0; i < MAXIMUM_XBEE_ID; i++) |
56 | 56 |
{ |
57 | 57 |
m.joined[i] = 0; |
58 |
for (j = 0; j < MAXIMUM_XBEE_ID; j++) |
|
59 |
m.matrix[i][j] = READING_UNKNOWN; |
|
60 | 58 |
} |
61 | 59 |
} |
62 | 60 |
|
... | ... | |
69 | 67 |
*/ |
70 | 68 |
void sensor_matrix_set_reading(int observer, int robot, int reading) |
71 | 69 |
{ |
72 |
if (robot >= MAXIMUM_XBEE_ID || observer >= MAXIMUM_XBEE_ID) |
|
73 |
{ |
|
74 |
WL_DEBUG_PRINT("ID too large."); |
|
75 |
return; |
|
76 |
} |
|
77 | 70 |
|
78 |
m.matrix[observer][robot] = (unsigned char)reading; |
|
79 | 71 |
} |
80 | 72 |
|
81 | 73 |
/** |
... | ... | |
88 | 80 |
**/ |
89 | 81 |
int sensor_matrix_get_reading(int observer, int robot) |
90 | 82 |
{ |
91 |
if (observer >= MAXIMUM_XBEE_ID || robot >= MAXIMUM_XBEE_ID) |
|
92 |
return -1; |
|
93 |
|
|
94 |
return (int)m.matrix[observer][robot]; |
|
83 |
return -1; |
|
95 | 84 |
} |
96 | 85 |
|
97 | 86 |
/** |
... | ... | |
104 | 93 |
{ |
105 | 94 |
if (robot >= MAXIMUM_XBEE_ID) |
106 | 95 |
{ |
96 |
usb_puts("ID too large.\n\r"); |
|
107 | 97 |
WL_DEBUG_PRINT("ID too large."); |
108 | 98 |
return; |
109 | 99 |
} |
Also available in: Unified diff