Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow println to send \n and not \r\n #7364

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

Closed
hmaarrfk wants to merge 1 commit into arduino:master from hmaarrfk:printlf

Conversation

Copy link

@hmaarrfk hmaarrfk commented Mar 22, 2018

No description provided.

Rotzbua reacted with thumbs down emoji
Copy link
Collaborator

I'm not sure if adding this to the API really is a good idea (to avoid cluttering the API). Doing a manual print("\n") can already do what you want, of course.

Copy link
Author

I understand not wanting clutter. I can reimplement this with a switch.

Maybe an option to choose between \n and \r\n.

Serial.setln("\n");

maybe?

I am working with large code bases many times new programmers where at times the difference betwen \r\n and \n. The code works, but the serial line endings are all over the place.

Refractoring the code is hard because it is challenging to test hardware with automated tests.

Would you consider alternative ways to changing the line ending?

Copy link
Author

@matthijskooijman I changed the implementation now to be less polluting. Default behaviour is the same, but it should be much easier to change the line endings if the user wants to.

let me know what you think

@hmaarrfk hmaarrfk changed the title (削除) printlf: prinln with only \n and not \r\n (削除ここまで) (追記) Allow println to send \n and not \r\n (追記ここまで) Mar 30, 2018
Copy link
Collaborator

This looks a lot better to me. I do still see a lot of whitespace changes in your PR, those must certainly be removed before merging.

One other question is the performance impact of this change. I wonder if the compiler is smart enough to optimize the line ending variable away.

Finally, it's not my call to merge this, but @cmaglie's or @facchinm's.

Copy link
Author

@matthijskooijman, Thanks for considering this. I will remove the whitespace if the PR is considered.

Copy link
Author

I guess I found the new home for this code

arduino/ArduinoCore-avr#18

Copy link
Collaborator

Correct, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Print and Stream class The Arduino core library's Print and Stream classes
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /