From f626a4f21d7301e573bcb601f16bf6ba38352c34 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Fri, 13 Aug 2010 17:28:08 -0700 Subject: Fixed behavior when no GPS present. --- firmware/microblaze/lib/hal_io.c | 4 ++-- firmware/microblaze/lib/hal_uart.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'firmware') diff --git a/firmware/microblaze/lib/hal_io.c b/firmware/microblaze/lib/hal_io.c index a8654bce7..261c8cc2a 100644 --- a/firmware/microblaze/lib/hal_io.c +++ b/firmware/microblaze/lib/hal_io.c @@ -256,9 +256,9 @@ int fngets_timeout(hal_uart_name_t u, char * const s, int len) { char *x = s; - while(((*x=(char)hal_uart_getc_timeout(u)) != '\n') && ((x-s) < len)) x++; + + while(((*x=(char)hal_uart_getc_timeout(u)) != '\n') && (*x != -1) && ((x-s) < len)) x++; *x = 0; - if(x==s) return 0; return (x-s); } diff --git a/firmware/microblaze/lib/hal_uart.c b/firmware/microblaze/lib/hal_uart.c index 9697f5b20..0ac6abd69 100644 --- a/firmware/microblaze/lib/hal_uart.c +++ b/firmware/microblaze/lib/hal_uart.c @@ -108,8 +108,7 @@ hal_uart_getc_timeout(hal_uart_name_t u) int timeout = 0; while (((uart_regs[u].rxlevel) == 0) && (timeout++ < HAL_UART_TIMEOUT_MS)) mdelay(1); - - return (timeout == HAL_UART_TIMEOUT_MS) ? '\n' : uart_regs[u].rxchar; //return a newline if nothing there, this will trip fngets to quit + return (timeout == HAL_UART_TIMEOUT_MS) ? -1 : uart_regs[u].rxchar; //return -1 if nothing there, cause fngets to quit } int hal_uart_rx_flush(hal_uart_name_t u) -- cgit v1.2.3