1.按单字符处理接收,避免出现在urc事件中读取数据时,导致后面数据丢失问题.

2.解决多任务发送时,接收完成信号量提前释放的问题。
This commit is contained in:
魔罗 2021-11-28 15:57:36 +08:00
parent f1a4fb8320
commit 2c89bb8208

8
at.c
View File

@ -16,6 +16,8 @@
* 2021-04-08 Morro * 2021-04-08 Morro
* 2021-05-15 Morro URC匹配程序 * 2021-05-15 Morro URC匹配程序
* 2021-07-20 Morro ,at_do_work时urc部分数据丢失问题 * 2021-07-20 Morro ,at_do_work时urc部分数据丢失问题
* 2021-11-20 Morro ,urc事件中读取数据时
*
****************************************************************************** ******************************************************************************
*/ */
#include "at.h" #include "at.h"
@ -317,7 +319,9 @@ static void urc_recv_process(at_obj_t *at, const char *buf, unsigned int size)
*/ */
static void resp_notification(at_obj_t *at, at_return ret) static void resp_notification(at_obj_t *at, at_return ret)
{ {
at->ret = ret; at->ret = ret;
at->resp = NULL;
at_sem_post(at->completed); at_sem_post(at->completed);
} }
@ -398,7 +402,7 @@ void at_resume(at_obj_t *at)
*/ */
void at_process(at_obj_t *at) void at_process(at_obj_t *at)
{ {
char buf[16]; char buf[1];
unsigned int len; unsigned int len;
if (!at_sem_wait(at->recv_lock, MAX_AT_LOCK_TIME)) if (!at_sem_wait(at->recv_lock, MAX_AT_LOCK_TIME))
return; return;