X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=blobdiff_plain;f=commands.c;h=3448dedccb7c2b063fd01141c30c3c1a5ad6985a;hp=cf060fc902fc3d77eca8c26e5f87b8b09d614b33;hb=852fd37145aaaee0ce2117f5c8173f5b86020fd0;hpb=3abe93f4b90cf10d3d29dcb48e90dd65353e0bc5 diff --git a/commands.c b/commands.c index cf060fc..3448ded 100644 --- a/commands.c +++ b/commands.c @@ -1288,94 +1288,6 @@ const parse_inst_t PROGMEM cmd_raw = { }, }; -/* ************* */ - -/* this structure is filled when cmd_dump is parsed successfully */ -struct cmd_dump_result { - fixed_string_t dump; - fixed_string_t onoff; -}; - -/* function called when cmd_dump is parsed successfully */ -static void cmd_dump_parsed(void *parsed_result, void *data) -{ - struct cmd_dump_result *res = parsed_result; - - (void)data; - if (!strcmp(res->onoff, "on")) - xbee_hexdump = 1; - else - xbee_hexdump = 0; -} - -const char PROGMEM str_dump[] = "dump"; -const char PROGMEM str_dump_onoff[] = "on#off"; - -const parse_token_string_t PROGMEM cmd_dump_dump = - TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump, - str_dump); - -const parse_token_string_t PROGMEM cmd_dump_onoff = - TOKEN_STRING_INITIALIZER(struct cmd_dump_result, onoff, - str_dump_onoff); - -const char PROGMEM help_dump[] = "enable/disable hexdump of received packets"; - -const parse_inst_t PROGMEM cmd_dump = { - .f = cmd_dump_parsed, /* function to call */ - .data = NULL, /* 2nd arg of func */ - .help_str = help_dump, - .tokens = { /* token list, NULL terminated */ - (PGM_P)&cmd_dump_dump, - (PGM_P)&cmd_dump_onoff, - NULL, - }, -}; - -/* ************* */ - -/* this structure is filled when cmd_debug is parsed successfully */ -struct cmd_debug_result { - fixed_string_t debug; - fixed_string_t onoff; -}; - -/* function called when cmd_debug is parsed successfully */ -static void cmd_debug_parsed(void *parsed_result, void *data) -{ - struct cmd_debug_result *res = parsed_result; - - (void)data; - if (!strcmp(res->onoff, "on")) - xbee_debug = 1; - else - xbee_debug = 0; -} - -const char PROGMEM str_debug[] = "debug"; -const char PROGMEM str_debug_onoff[] = "on#off"; - -const parse_token_string_t PROGMEM cmd_debug_debug = - TOKEN_STRING_INITIALIZER(struct cmd_debug_result, debug, - str_debug); - -const parse_token_string_t PROGMEM cmd_debug_onoff = - TOKEN_STRING_INITIALIZER(struct cmd_debug_result, onoff, - str_debug_onoff); - -const char PROGMEM help_debug[] = "enable/disable additionnal debug"; - -const parse_inst_t PROGMEM cmd_debug = { - .f = cmd_debug_parsed, /* function to call */ - .data = NULL, /* 2nd arg of func */ - .help_str = help_debug, - .tokens = { /* token list, NULL terminated */ - (PGM_P)&cmd_debug_debug, - (PGM_P)&cmd_debug_onoff, - NULL, - }, -}; - /**********************************************************/ /* this structure is filled when cmd_baudrate is parsed successfully */ @@ -1937,8 +1849,6 @@ const parse_ctx_t PROGMEM main_ctx[] = { &cmd_monitor_del, &cmd_ping, &cmd_raw, - &cmd_dump, - &cmd_debug, &cmd_baudrate, &cmd_beep, &cmd_servo_set,