X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Frobotsim.c;h=2d0d7bebbba15245ef27f626c76ca308418bd545;hp=a0fa5a0eba8baf1f6654b8b0ed559c64050943bc;hb=9d056416278ae5d772a0fc1f7d2d11a4461fb673;hpb=b022f257a5ee568737e1a684a83d0154397fffcb diff --git a/projects/microb2010/mainboard/robotsim.c b/projects/microb2010/mainboard/robotsim.c index a0fa5a0..2d0d7be 100644 --- a/projects/microb2010/mainboard/robotsim.c +++ b/projects/microb2010/mainboard/robotsim.c @@ -57,9 +57,23 @@ static int32_t l_pwm, r_pwm; static int32_t l_enc, r_enc; static int fdr, fdw; +/* + * Debug with GDB: + * + * (gdb) handle SIGUSR1 pass + * Signal Stop Print Pass to program Description + * SIGUSR1 Yes Yes Yes User defined signal 1 + * (gdb) handle SIGUSR2 pass + * Signal Stop Print Pass to program Description + * SIGUSR2 Yes Yes Yes User defined signal 2 + * (gdb) handle SIGUSR1 noprint + * Signal Stop Print Pass to program Description + * SIGUSR1 No No Yes User defined signal 1 + * (gdb) handle SIGUSR2 noprint + */ /* */ -#define FILTER 97 +#define FILTER 98 #define FILTER2 (100-FILTER) #define SHIFT 4 @@ -67,11 +81,16 @@ void robotsim_dump(void) { char buf[BUFSIZ]; int len; + int16_t x, y, a; + + x = position_get_x_s16(&mainboard.pos); + y = position_get_y_s16(&mainboard.pos); + a = position_get_a_deg_s16(&mainboard.pos); +/* y = COLOR_Y(y); */ +/* a = COLOR_A(a); */ len = snprintf(buf, sizeof(buf), "pos=%d,%d,%d\n", - position_get_x_s16(&mainboard.pos), - position_get_y_s16(&mainboard.pos), - position_get_a_deg_s16(&mainboard.pos)); + x, y, a); hostsim_lock(); write(fdw, buf, len); hostsim_unlock();