aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/microblaze')
-rw-r--r--firmware/microblaze/lib/hal_io.c1
-rw-r--r--firmware/microblaze/lib/hal_uart.c2
-rw-r--r--firmware/microblaze/lib/hal_uart.h2
3 files changed, 3 insertions, 2 deletions
diff --git a/firmware/microblaze/lib/hal_io.c b/firmware/microblaze/lib/hal_io.c
index 0e3754958..f93b20030 100644
--- a/firmware/microblaze/lib/hal_io.c
+++ b/firmware/microblaze/lib/hal_io.c
@@ -258,6 +258,7 @@ 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++;
*x = 0;
+ if(x==s) return 0;
return (x-s)-1;
}
diff --git a/firmware/microblaze/lib/hal_uart.c b/firmware/microblaze/lib/hal_uart.c
index 4d754d5e5..9697f5b20 100644
--- a/firmware/microblaze/lib/hal_uart.c
+++ b/firmware/microblaze/lib/hal_uart.c
@@ -109,7 +109,7 @@ hal_uart_getc_timeout(hal_uart_name_t u)
while (((uart_regs[u].rxlevel) == 0) && (timeout++ < HAL_UART_TIMEOUT_MS))
mdelay(1);
- return (uart_regs[u].rxlevel == 0) ? 0 : uart_regs[u].rxchar;
+ return (timeout == HAL_UART_TIMEOUT_MS) ? '\n' : uart_regs[u].rxchar; //return a newline if nothing there, this will trip fngets to quit
}
int hal_uart_rx_flush(hal_uart_name_t u)
diff --git a/firmware/microblaze/lib/hal_uart.h b/firmware/microblaze/lib/hal_uart.h
index b9b0a5e14..758c8cb5e 100644
--- a/firmware/microblaze/lib/hal_uart.h
+++ b/firmware/microblaze/lib/hal_uart.h
@@ -27,7 +27,7 @@
#define DEFAULT_UART UART_DEBUG //which UART printf, gets, etc. use
-#define HAL_UART_TIMEOUT_MS 100
+#define HAL_UART_TIMEOUT_MS 300
typedef enum {
US_9600 = 0,