From 05d21a62e72418966a20b2f0a739b211c0e61b3d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 22 Apr 2014 09:31:25 -0600 Subject: [PATCH] Updates to the serialrx example from Bob Doison --- examples/serialrx/Makefile | 2 +- examples/serialrx/send.py | 14 +++++++------- examples/serialrx/serialrx_main.c | 11 ++++++----- nshlib/nsh_parse.c | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/serialrx/Makefile b/examples/serialrx/Makefile index d99fd44a5..66d485b8d 100644 --- a/examples/serialrx/Makefile +++ b/examples/serialrx/Makefile @@ -63,7 +63,7 @@ ROOTDEPPATH = --dep-path . # Built-in application info APPNAME = serialrx -PRIORITY = SCHED_PRIORITY_DEFAULT +PRIORITY = SCHED_PRIORITY_LOW STACKSIZE = 2048 # Common build diff --git a/examples/serialrx/send.py b/examples/serialrx/send.py index 366bd9da0..29477dc26 100644 --- a/examples/serialrx/send.py +++ b/examples/serialrx/send.py @@ -5,16 +5,16 @@ from time import sleep f = open(sys.argv[1], "w") s = "" -while len(s) < 960: +while len(s) < 11520: s += "1" print("Sending to %s" % sys.argv[1]) while(True): - #f.write(s); - #f.flush(); - for i in range(len(s)): - f.write(s[i]) - f.flush() - #sleep(0.050) + f.write(s); + f.flush(); + #for i in range(len(s)): + # f.write(s[i]) + # f.flush() + # #sleep(0.050) sys.stdout.write(".") sys.stdout.flush() diff --git a/examples/serialrx/serialrx_main.c b/examples/serialrx/serialrx_main.c index 4ff672098..21b3d9494 100644 --- a/examples/serialrx/serialrx_main.c +++ b/examples/serialrx/serialrx_main.c @@ -51,8 +51,8 @@ * Pre-processor Definitions ****************************************************************************/ -#undef BUFFERED_IO -#define CHUNK 960 +#define BUFFERED_IO +#define CHUNK 11520 /**************************************************************************** * Private Data @@ -70,7 +70,7 @@ static int count = 0; int serialrx_main(int argc, char *argv[]) { - FAR char *buf = (FAR char *)malloc(CHUNK*3); + FAR char *buf = (FAR char *)malloc(CHUNK); FAR FILE *f; printf("Reading from %s\n", argv[1]); f = fopen(argv[1], "r"); @@ -78,14 +78,15 @@ int serialrx_main(int argc, char *argv[]) while(1) { #ifdef BUFFERED_IO - int ret = fread(&buf[CHUNK], 1, CHUNK, f); + int ret = fread(buf, 1, CHUNK, f); #else - int ret = read(f->fs_fd, buf, CHUNK); + int ret = read(f->fs_fd, buf, CHUNK); #endif count += ret; if (count >= CHUNK) { printf("-"); + fflush(stdout); count -= CHUNK; } } diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index 4be4b9888..b0aa4c05c 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -484,7 +484,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, * indicates that the application task was spawned successfully * but returned failure exit status. * - * Note the priority if not effected by nice-ness. + * Note the priority is not effected by nice-ness. */ #ifdef CONFIG_NSH_FILE_APPS