Revision 294
Got the data response to work, however analog8 reads are failing to get good data.
test_main.c | ||
---|---|---|
4 | 4 |
#include "data_requests.h" |
5 | 5 |
#include "wireless.h" |
6 | 6 |
#include "wl_token_ring.h" |
7 |
#include "pthread.h" |
|
7 | 8 |
|
8 | 9 |
void IR_handler(unsigned char* data); |
9 | 10 |
void bom_handler(BomNode* head); |
... | ... | |
12 | 13 |
unsigned char bom_responded_flag; |
13 | 14 |
unsigned char ir_responded_flag; |
14 | 15 |
unsigned char encoder_responded_flag; |
16 |
void* wl_do_routine(void* arg){ |
|
17 |
while(1){ |
|
18 |
wl_do(); |
|
19 |
} |
|
20 |
} |
|
15 | 21 |
|
22 |
pthread_t* wl_do_thread; |
|
23 |
|
|
16 | 24 |
int main(void){ |
17 | 25 |
wl_set_com_port("/dev/cu.usbserial-A1000Qu6"); |
18 | 26 |
wl_init(); |
... | ... | |
24 | 32 |
ir_responded_flag = 0; |
25 | 33 |
encoder_responded_flag = 0; |
26 | 34 |
int test_count; |
35 |
|
|
36 |
wl_do_thread = malloc(sizeof(pthread_t)); |
|
37 |
pthread_create(wl_do_thread,NULL,wl_do_routine,NULL); |
|
38 |
|
|
27 | 39 |
while(1){ |
28 |
wl_do(); |
|
29 | 40 |
printf("."); |
30 | 41 |
wl_token_iterator_begin(); |
31 | 42 |
while(wl_token_iterator_has_next()){ |
... | ... | |
44 | 55 |
request_IR_data(robot_id); |
45 | 56 |
test_count=0; |
46 | 57 |
while(!(ir_responded_flag)&&(test_count++<20)){ |
47 |
wl_do(); |
|
48 | 58 |
printf("Waiting on %i..\n",robot_id); |
49 |
usleep(500000); |
|
59 |
usleep(5000000);
|
|
50 | 60 |
} |
51 | 61 |
/* |
52 | 62 |
request_encoder_data(robot_id); |
... | ... | |
55 | 65 |
} |
56 | 66 |
*/ |
57 | 67 |
} |
58 |
usleep(500000); |
|
68 |
usleep(5000000);
|
|
59 | 69 |
} |
60 | 70 |
} |
61 | 71 |
|
Also available in: Unified diff