You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • If AT+FOO returns 3 lines, your handler needs to accept all of those lines.

    If it doesn't then yes, your next call to AT.CMD may return the extra line. The AT library does flush lines, but obviously if you issue the command right after, while the last response is still coming in, it has no idea what line is from the old command and what's from the new.

    For example, this is what you're suggesting I think?

    Send> AT+FOO
    Recv< FooOne -> foohandler
    Recv< FooTwo -> foohandler
    Send> AT+BAR
    Recv< FooThree -> barhandler
    Recv< BarOne -> thrown away
    

    or if you just waited, the line would be thrown away:

    Send> AT+FOO
    Recv< FooOne -> foohandler
    Recv< FooTwo -> foohandler
    Wait 100ms before sending...
    Recv< FooThree -> thrown away
    Send> AT+BAR
    Recv< BarOne -> barhandler
    

    Realistically you want to handle all lines you're expecting to receive though. Not doing that is just asking for pain later on :)

About

Avatar for Gordon @Gordon started