From f166ac946bb20d3d739e5d5e9817aa92010ea13f Mon Sep 17 00:00:00 2001 From: zylx Date: Sat, 4 Aug 2018 18:43:46 +0800 Subject: [PATCH] [net][at] fix server repeated enter issue --- components/net/at/src/at_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index a148a20ab0..ebb37489b0 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -352,10 +352,10 @@ static char at_server_gerchar(void) { char ch; - if (rt_device_read(at_server_local->device, 0, &ch, 1) == 0) + while (rt_device_read(at_server_local->device, 0, &ch, 1) == 0) { + rt_sem_control(at_server_local->rx_notice, RT_IPC_CMD_RESET, RT_NULL); rt_sem_take(at_server_local->rx_notice, RT_WAITING_FOREVER); - rt_device_read(at_server_local->device, 0, &ch, 1); } return ch;