X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fcommands_traj.c;h=ea124d3cd0ceb4fd74d2846a43394f77f40c7fac;hp=f3b38fd9c8f843bb05898c81152f3d542497ea3a;hb=ef732b9dd629cab8602783d77bffa2395100393a;hpb=5918edd6f4f713ef3c8b0b0020dd30a4fb8222ae diff --git a/projects/microb2010/mainboard/commands_traj.c b/projects/microb2010/mainboard/commands_traj.c index f3b38fd..ea124d3 100644 --- a/projects/microb2010/mainboard/commands_traj.c +++ b/projects/microb2010/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 %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 */