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

Formatting issue of debug output in terminal #1398

Closed
serialrf433 opened this issue Jan 26, 2025 · 6 comments
Closed

Formatting issue of debug output in terminal #1398

serialrf433 opened this issue Jan 26, 2025 · 6 comments
Labels
enhancement New feature or request resolved Issue was resolved (e.g. bug fixed, or feature implemented)

Comments

@serialrf433
Copy link

Describe the bug

I enabled debugging to get more interesting output. The formatting of this output that i get out of the serial does not look like it should.
The normal output is correctly formatted [Radio]... . Its just the debugging output that does not look correctly.

To Reproduce

remove the // in the 4 lines before the #define
https://github.com/jgromes/RadioLib/blob/master/src/BuildOptUser.h

Expected behavior

Line1
Line2
Line3
Line4
...

Screenshots
Image

Additional info (please complete):

  • MCU: [compiled with arduino-cli version 1.1.1 for ESP32]
  • Computer-OS: Linux (using different ones, same on all)
@HeadBoffin
Copy link
Collaborator

You may want to learn about line endings over serial - there are three combinations and you need to tell your command line software which one to translate in to line endings for the terminal.

@StevenCellist StevenCellist added the question Generic question about code or usage label Jan 30, 2025
@serialrf433
Copy link
Author

But the line endings over serial should be constant. I am using serial with other projects and esp32 or other MCU's but never had such a issue. Serial simply always worked and was correctly formatted. Here its not. The normal output have correct formatting but the debugging have not. Or to say it with 'line endings over serial': they should be consistent independent if debugging is enabled or not.

@StevenCellist
Copy link
Collaborator

RadioLib uses \n or LF as line endings, which most systems can parse just fine. Especially Linux is a LF-based OS, but some terminals still want to see a CR or '\r' as well. I recently encountered PuTTY, where I needed to check "Implicit line break on LF" as well.

@jgromes up to you to add \r or not.

@serialrf433
Copy link
Author

serialrf433 commented Feb 9, 2025

I vote for adding this \r . Having things just working with as much compatibility as possible is always a good thing. It seems to be already like this on the normal, non-debug output. So lets have this like this also at the debug output.

@jgromes
Copy link
Owner

jgromes commented Feb 11, 2025

I think I know what's going on now - @serialrf433 is using Arduino, which uses CR+LF for Serial.println, that's where the inconsistency is coming from. Of course, everything would have been displayed correctly had his (as of yet unspecified) serial console application treated LF as actual line end (as most well behaved serial consoles do). Having a mix of CR+LF and LF endings is not uncommon, even the default Arduino Serial monitor handles this correctly.

Internally, RadioLib consistently uses LF only.

That being said, there is a lot of users of RadioLib on Arduino, so I will do two things:

  1. Make the RadioLib internal line feed configurable via a build-time option
  2. Use CR+LF as the default.

@jgromes jgromes closed this as completed Feb 11, 2025
@jgromes jgromes added enhancement New feature or request resolved Issue was resolved (e.g. bug fixed, or feature implemented) and removed question Generic question about code or usage labels Feb 11, 2025
@StevenCellist
Copy link
Collaborator

Did you just call PuTTY not well-behaved @jgromes? ;)

jgromes pushed a commit that referenced this issue Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resolved Issue was resolved (e.g. bug fixed, or feature implemented)
Projects
None yet
Development

No branches or pull requests

4 participants