X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2009%2Fmainboard%2Fcommands_traj.c;h=170dce898fa844d27b3efa3993cc589bc3704109;hp=82477a33bd948d7030cbf6c432cd0136255e9fcd;hb=e0908eab4d4b00cf19083f91a9921b3e8d0cae63;hpb=966d2c97e5fda37297568c5e8ed66271e986bcdd;ds=sidebyside diff --git a/projects/microb2009/mainboard/commands_traj.c b/projects/microb2009/mainboard/commands_traj.c index 82477a3..170dce8 100644 --- a/projects/microb2009/mainboard/commands_traj.c +++ b/projects/microb2009/mainboard/commands_traj.c @@ -125,6 +125,65 @@ parse_pgm_inst_t cmd_traj_speed_show = { }, }; +/**********************************************************/ +/* circle coef configuration */ + +/* this structure is filled when cmd_circle_coef is parsed successfully */ +struct cmd_circle_coef_result { + fixed_string_t arg0; + fixed_string_t arg1; + float circle_coef; +}; + + +/* function called when cmd_circle_coef is parsed successfully */ +static void cmd_circle_coef_parsed(void *parsed_result, void *data) +{ + struct cmd_circle_coef_result *res = parsed_result; + + if (!strcmp_P(res->arg1, PSTR("set"))) { + trajectory_set_circle_coef(&mainboard.traj, res->circle_coef); + } + + printf_P(PSTR("circle_coef set %2.2f\r\n"), mainboard.traj.circle_coef); +} + +prog_char str_circle_coef_arg0[] = "circle_coef"; +parse_pgm_token_string_t cmd_circle_coef_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_circle_coef_result, arg0, str_circle_coef_arg0); +prog_char str_circle_coef_arg1[] = "set"; +parse_pgm_token_string_t cmd_circle_coef_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_circle_coef_result, arg1, str_circle_coef_arg1); +parse_pgm_token_num_t cmd_circle_coef_val = TOKEN_NUM_INITIALIZER(struct cmd_circle_coef_result, circle_coef, FLOAT); + +prog_char help_circle_coef[] = "Set circle coef"; +parse_pgm_inst_t cmd_circle_coef = { + .f = cmd_circle_coef_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_circle_coef, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_circle_coef_arg0, + (prog_void *)&cmd_circle_coef_arg1, + (prog_void *)&cmd_circle_coef_val, + NULL, + }, +}; + +/* show */ + +prog_char str_circle_coef_show_arg[] = "show"; +parse_pgm_token_string_t cmd_circle_coef_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_circle_coef_result, arg1, str_circle_coef_show_arg); + +prog_char help_circle_coef_show[] = "Show circle coef"; +parse_pgm_inst_t cmd_circle_coef_show = { + .f = cmd_circle_coef_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_circle_coef_show, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_circle_coef_arg0, + (prog_void *)&cmd_circle_coef_show_arg, + NULL, + }, +}; + /**********************************************************/ /* trajectory window configuration */