Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

接收的消息同时含有期望的字符串和“OK”时,at_echo->__expect_notify还没来得及获取,at_echo->status = AT_ECHO_STATUS_EXPECT;就立马有被任务“at_parser”更新成at_echo->status = AT_ECHO_STATUS_OK; #330

Open
zhaoxwgit opened this issue Mar 10, 2022 · 3 comments

Comments

@zhaoxwgit
Copy link

    if (at_parse_status == AT_PARSE_STATUS_EXPECT) {
        at_echo->status = AT_ECHO_STATUS_EXPECT;
        if (at_echo->__is_expecting) {
            tos_sem_post(&at_echo->__expect_notify);
        }
    } else if (at_parse_status == AT_PARSE_STATUS_OK) {
        if (!at_echo->__is_expecting) {
        	at_echo->status = AT_ECHO_STATUS_OK;
            tos_sem_post(&at_echo->__status_set_notify);
        }
    } else if (at_parse_status == AT_PARSE_STATUS_FAIL) {
        at_echo->status = AT_ECHO_STATUS_FAIL;
        if (!at_echo->__is_expecting) {
            tos_sem_post(&at_echo->__status_set_notify);
        }
    } else if (at_parse_status == AT_PARSE_STATUS_ERROR) {
        at_echo->status = AT_ECHO_STATUS_ERROR;
        if (!at_echo->__is_expecting) {
            tos_sem_post(&at_echo->__status_set_notify);
        }
    }
@Mculover666
Copy link
Collaborator

if (!at_echo->__is_expecting) {

这里是!,__is_expecting=1时,不会进入到at_echo->status = AT_ECHO_STATUS_OK的逻辑,您是在实际使用时碰到了这个异常情况吗?

@zhaoxwgit
Copy link
Author

zhaoxwgit commented Mar 11, 2022

接收的消息同时含有期望的字符串和“OK”时,at_echo->__expect_notify还没来得及获取,at_echo->status = AT_ECHO_STATUS_EXPECT;就立马有被任务“at_parser”更新成at_echo->status = AT_ECHO_STATUS_OK;这样等tos_sem_pend
(&at_echo->__expect_notify);时已经变了,直接跳过了。实际遇到的。

@zhaoxwgit
Copy link
Author

建议在得到状态后,找个合适的地方清除 recv_cache

@zhaoxwgit zhaoxwgit changed the title at_echo->__is_expecting = 1 时 也会让 at_echo->status = AT_ECHO_STATUS_OK; 接收的消息同时含有期望的字符串和“OK”时,at_echo->__expect_notify还没来得及获取,at_echo->status = AT_ECHO_STATUS_EXPECT;就立马有被任务“at_parser”更新成at_echo->status = AT_ECHO_STATUS_OK; Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@zhaoxwgit @Mculover666 and others