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.CMDmay 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?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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?
or if you just waited, the line would be thrown away:
Realistically you want to handle all lines you're expecting to receive though. Not doing that is just asking for pain later on :)