diff options
| author | Bernard Xiong <[email protected]> | 2021-03-03 08:53:01 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-03 08:53:01 +0800 |
| commit | fac97f17168c964684bb86ad905a86e16681c78b (patch) | |
| tree | 2ab59a058ecd5b545d2faae2ded44a010001f14e | |
| parent | 3c5c7491fe431a5d625a75002ba9dbb742c21298 (diff) | |
| parent | eaacc0ae3e90eb381cad6e42183902f466eecdad (diff) | |
Merge pull request #4305 from OpenNuvoton/revert-3293-fix_at
Revert "fix the bug that rx_notice out of sync when data received aft…
| -rw-r--r-- | components/net/at/src/at_client.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index b9d0ee89cb..f46abd5cd4 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -434,20 +434,18 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo { rt_err_t result = RT_EOK; -__retry: - result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)); - if (result != RT_EOK) - { - return result; - } - if(rt_device_read(client->device, 0, ch, 1) == 1) - { - return RT_EOK; - } - else + while (rt_device_read(client->device, 0, ch, 1) == 0) { - goto __retry; + result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)); + if (result != RT_EOK) + { + return result; + } + + rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL); } + + return RT_EOK; } /** |
