root / trunk / code / projects / diagnostic_station / station / dump_robot.c @ 1295
History | View | Annotate | Download (1.3 KB)
| 1 | #include "dump_robot.h" |
|---|---|
| 2 | |
| 3 | #include <dragonfly_lib.h> |
| 4 | |
| 5 | #include "global.h" |
| 6 | #include "comm_robot.h" |
| 7 | |
| 8 | |
| 9 | void dump_robot_encoders (void) |
| 10 | {
|
| 11 | int16_t left, right; |
| 12 | char c;
|
| 13 | |
| 14 | robot_reset_encoders (); |
| 15 | |
| 16 | while (usb_getc_nb (&c)==-1) |
| 17 | {
|
| 18 | robot_read_encoders (&left, &right); |
| 19 | |
| 20 | usb_puts ("Left: "); usb_puti (left ); usb_puts (NL);
|
| 21 | usb_puts ("Right: "); usb_puti (right); usb_puts (NL);
|
| 22 | usb_puts (NL NL); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | void dump_robot_rangefinders (void) |
| 27 | {
|
| 28 | uint16_t rf[5];
|
| 29 | char c;
|
| 30 | |
| 31 | while (usb_getc_nb (&c)==-1) |
| 32 | {
|
| 33 | // First read all of the values, then print them, because it's much more readable that way.
|
| 34 | |
| 35 | for (uint8_t i=0; i<5; ++i) |
| 36 | {
|
| 37 | robot_read_rangefinder (i, &rf[i]); |
| 38 | } |
| 39 | |
| 40 | for (uint8_t i=0; i<5; ++i) |
| 41 | {
|
| 42 | usb_puti (i); |
| 43 | usb_puts (": ");
|
| 44 | usb_puti (rf[i]); |
| 45 | usb_puts (NL); |
| 46 | } |
| 47 | |
| 48 | usb_puts (NL NL); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | void dump_robot_bom (void) |
| 53 | {
|
| 54 | int16_t bom[16];
|
| 55 | char c;
|
| 56 | |
| 57 | while (usb_getc_nb (&c)==-1) |
| 58 | {
|
| 59 | // First read all of the values, then print them, because it's much more readable that way.
|
| 60 | |
| 61 | //for (uint8_t i=0; i<16; ++i)
|
| 62 | //robot_read_bom (i, &bom[i]);
|
| 63 | |
| 64 | robot_read_bom_all (bom); |
| 65 | |
| 66 | for (uint8_t i=0; i<16; ++i) |
| 67 | {
|
| 68 | if (i<10) usb_puts (" "); |
| 69 | usb_puti (i); |
| 70 | usb_puts (": ");
|
| 71 | usb_puti (bom[i]); |
| 72 | usb_puts (NL); |
| 73 | } |
| 74 | usb_puts (NL NL); |
| 75 | } |
| 76 | } |