Browse Source

[net][at] fix repeated enter issue

zylx 7 years ago
parent
commit
e5d9bb9013
1 changed files with 2 additions and 2 deletions
  1. 2 2
      components/net/at/src/at_client.c

+ 2 - 2
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;