summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzylx <[email protected]>2018-08-04 17:38:16 +0800
committerzylx <[email protected]>2018-08-04 17:44:12 +0800
commite5d9bb90136d513e6b62d473a7f8a5ad9eeecf54 (patch)
treeda3e84245b1f15dcc1fee2191c1907119d9208c1
parent7cb670b20578588dc882544b63b5546c7929c4ee (diff)
[net][at] fix repeated enter issue
-rw-r--r--components/net/at/src/at_client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c
index 90fd3291c3..8e5161f2ce 100644
--- a/components/net/at/src/at_client.c
+++ b/components/net/at/src/at_client.c
@@ -355,10 +355,10 @@ static char at_client_getchar(void)
{
char ch;
- if (rt_device_read(at_client_local->device, 0, &ch, 1) == 0)
+ while (rt_device_read(at_client_local->device, 0, &ch, 1) == 0)
{
+ rt_sem_control(at_client_local->rx_notice, RT_IPC_CMD_RESET, RT_NULL);
rt_sem_take(at_client_local->rx_notice, RT_WAITING_FOREVER);
- rt_device_read(at_client_local->device, 0, &ch, 1);
}
return ch;