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

LORA_AT_DEBUG to eagerly consuming messages #1

Open
simplysoft opened this issue Sep 16, 2024 · 0 comments
Open

LORA_AT_DEBUG to eagerly consuming messages #1

simplysoft opened this issue Sep 16, 2024 · 0 comments

Comments

@simplysoft
Copy link

When LORA_AT_DEBUG was enabled, we were are not able to get the received Class C messages from the library. After further analysis, it looks like when LORA_AT_DEBUG is enabled, multiple lines from the mode are being consumed when +LOG is found, essentially throwing away the following line that would have contained the information about received message

The issue can be seen when TINY_GSM_DEBUG_DEEP is enabled. An unproblematic example:

[19767] Verbose details <<< +LOG: DEBUG
+LOG: DEBUG    15082 LW      ch 01
+LOG: DEBUG    15082 LORA    RX, 868300000, SF12, 125KHz, 6 >>>

Problematic that causes the message not to be processed

[62441] Verbose details <<< +LOG: DEBUG    57203 LORA    RX, 6038EB0B2680010001FAC9AC93D7, -13, 10
+LOG: DEBUG    57207 LORA    RX, 869525000, SF9, 125KHz, 0
+MSG: PORT: 1; RX: "00"
+MSG: RXWIN0, RSSI -13, SNR 10.0
+MSG: Done >>>

Culprit seems to be thisModem().stream.readStringUntil(AT_NL[len_atnl]);
Not sure what the actual intention was: read until the last character of AT_NL or read until end of string / null byte (because AT_NL[len_atnl] is off-by-one)?

Changing it to thisModem().stream.readStringUntil(AT_NL[0]) seems to work in our situation that log messages are processed line by line (using LoRaE5), but there might be a more robust solution

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

1 participant