Updates to the serialrx example from Bob Doison

This commit is contained in:
Gregory Nutt 2014-04-22 09:31:25 -06:00
parent c907a27469
commit 05d21a62e7
4 changed files with 15 additions and 14 deletions

View File

@ -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

View File

@ -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()

View File

@ -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;
}
}

View File

@ -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