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

Add printf to print class #28

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

Open
MCUdude wants to merge 1 commit into arduino:master
base: master
Choose a base branch
Loading
from MCUdude:master
Open

Conversation

Copy link

@MCUdude MCUdude commented Feb 28, 2019

Printf is super useful. This PR will let users use Serial.printf

henrygab and gbr1 reacted with thumbs up emoji
Copy link

Didn't Massimo (@mbanzi) say very clearly, only 2 weeks ago on the developers mail list, that this would not be accepted?

Copy link
Author

MCUdude commented Feb 28, 2019

That may be true, but I'm not in the developer mailing list 😉
I don't quite see why printf is such a bad thing to have available though.

Copy link

I'm not going to argue this. My only point is this has been proposed over and over, and the Arduino devs have clearly said it does not belong in Arduino's API. Now that you know this, you can look up what they've said and argue if you like.

Copy link
Author

MCUdude commented Feb 28, 2019

Did some google-fu and found the threads you're referring to. It's really weird, but many (most) of the "We should implement printf in print class" discussions ends up with ranting and personal attacks.

Personally I'd love to see this merged because I personally find printf easy to use and understand. However I'd of course respect if the Arduino Gods have a different opinion than me.

I'll leave this open until it's merged or closed by any of the developers.

Copy link
Collaborator

per1234 commented Feb 28, 2019

I believe this is the specific statement from Massimo Banzi that Paul Stoffregen referred to:
https://groups.google.com/a/arduino.cc/d/msg/developers/E0pUPWeDE2Y/GPWl9Nw1BwAJ

Related:
https://github.com/arduino/Arduino/issues/2416

Copy link

Clearly a lot of people have strong feelings on this matter. Some of those folks may have more passion than wisdom.

FWIW, I have some printf code similar to what Bill Perry suggested just today, but it uses Arduino's Print class rather than duplicating so much code and allocating big buffers. When I get a break in working on hardware, I'm planning to turn it into a nice library that works on all boards.

henrygab reacted with thumbs up emoji henrygab reacted with heart emoji

Copy link

Floessie commented Mar 1, 2019

@PaulStoffregen

I have some printf code similar to what Bill Perry suggested just today

Paul, could you add a link, please? Just out of interest...

Copy link
Collaborator

per1234 commented Mar 21, 2019

could you add a link, please? Just out of interest...

I believe this is it:
https://groups.google.com/a/arduino.cc/d/msg/developers/sTacUMEXBTw/H2v9GabLBAAJ

Copy link

PaulStoffregen commented Mar 21, 2019
edited
Loading

Bill's code allocates a 128 byte buffer on the stack.

Sorry, my own no-buffer printf code isn't public at this time. I already maintain a couple dozen libs, which regularly get requests for platform-specific issues (the ESP folks are the worst - so much breaks on those chips...), so I'm not very inclined to release yet another library in an "alpha" quality state.

Edit: Just to be clear, technically any "no buffer" code that relies on Arduino's Print class does involve a 33 byte buffer allocated on the stack, due to Arduino's Print::printNumber() function.

Floessie reacted with laugh emoji

Copy link

CLAassistant commented Apr 9, 2021
edited
Loading

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

my StreamLib enables to use printf without support in core API.
https://github.com/JAndrassy/StreamLib#formatted-printing
and the implementation doesn't use a buffer. it has avr, arm end esp implementation.
https://github.com/JAndrassy/StreamLib/blob/master/src/PrintPlus.cpp

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
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Print.h add printf API

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