From: Fabrice Desclaux Date: Tue, 21 Feb 2012 18:20:16 +0000 (+0100) Subject: command: replace printf printf_P X-Git-Url: http://git.droids-corp.org/?p=protos%2Fxbee-avr.git;a=commitdiff_plain;h=4a9064f33ceb22c3b73b99fc1ac9c20b84ab09e5 command: replace printf printf_P --- diff --git a/commands.c b/commands.c index 1cacfed..986ca92 100644 --- a/commands.c +++ b/commands.c @@ -396,7 +396,7 @@ static void cmd_write_parsed(void *parsed_result, void *data) param = &res->u32; } else { - printf("Unknown argument type\n"); + printf_P(PSTR("Unknown argument type\r\n")); return; } memcpy_P(&cmd, copy.name, 2); @@ -612,7 +612,7 @@ static void cmd_range_parsed(void *parsed_result, void *data) } else if (!strcmp(res->action, "start")) { if (range_running) { - printf("already running\n"); + printf_P(PSTR("already running\r\n")); return; } range_cur_count = range_count; @@ -623,7 +623,7 @@ static void cmd_range_parsed(void *parsed_result, void *data) } else if (!strcmp(res->action, "end")) { if (range_running == 0) { - printf("not running\n"); + printf_P(PSTR("not running\r\n")); return; } range_running = 0; @@ -669,7 +669,7 @@ static void cmd_range_period_parsed(void *parsed_result, void *data) struct cmd_range_period_result *res = parsed_result; if (res->period < 10) { - printf("error, minimum period is 10 ms\n"); + printf_P(PSTR("error, minimum period is 10 ms\r\n")); return; } @@ -847,15 +847,15 @@ static void cmd_monitor_parsed(void *parsed_result, void *data) printf_P(PSTR("monitor period is %d ms, %d regs in list\r\n"), monitor_period_ms, monitor_count); LIST_FOREACH(m, &xbee_monitor_list, next) - printf_P(PSTR(" %S\n"), m->desc); + printf_P(PSTR(" %S\r\n"), m->desc); } else if (!strcmp_P(res->action, PSTR("start"))) { if (monitor_running) { - printf("already running\n"); + printf_P(PSTR("already running\r\n")); return; } if (monitor_count == 0) { - printf("no regs to be monitored\n"); + printf_P(PSTR("no regs to be monitored\r\n")); return; } callout_init(&monitor_event); @@ -869,7 +869,7 @@ static void cmd_monitor_parsed(void *parsed_result, void *data) } else if (!strcmp_P(res->action, PSTR("end"))) { if (monitor_running == 0) { - printf("not running\n"); + printf_P(PSTR("not running\r\n")); return; } monitor_running = 0; @@ -923,13 +923,13 @@ static void cmd_monitor_add_parsed(void *parsed_result, void *data) } if (m != NULL) { - printf("already exist\n"); + printf_P(PSTR("already exist\r\n")); return; } m = malloc(sizeof(*m)); if (m == NULL) { - printf("no mem\n"); + printf_P(PSTR("no mem\r\n")); return; } m->desc = copy.desc; @@ -980,7 +980,7 @@ static void cmd_monitor_period_parsed(void *parsed_result, void *data) struct cmd_monitor_period_result *res = parsed_result; if (res->period < 100) { - printf("error, minimum period is 100 ms\n"); + printf_P(PSTR("error, minimum period is 100 ms\r\n")); return; } @@ -1032,7 +1032,7 @@ static void cmd_monitor_del_parsed(void *parsed_result, void *data) free(res->m); monitor_count --; if (monitor_count == 0) { - printf("Disable monitoring, no more event\n"); + printf_P(PSTR("Disable monitoring, no more event\r\n")); callout_stop(&cm, &monitor_event); monitor_running = 0; return; @@ -1107,7 +1107,7 @@ struct cmd_raw_result { /* function called when cmd_raw is parsed successfully */ static void cmd_raw_parsed(void *parsed_result, void *data) { - printf("switched to raw mode, CTRL-D to exit\n"); + printf_P(PSTR("switched to raw mode, CTRL-D to exit\r\n")); rdline_stop(&xbeeboard.rdl); /* don't display prompt when return */ xbee_raw = 1; }