You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
consider this printf implementation with stdio fopencookie function #4713
The suggested code snippet doesn't have any explanation or context. Nothing to do here. If you have a need for this, I suggest making a PR with an example or some explanation. Closing as an issue.
current implementation of printf in Print in esp8266 core calls vsnprintf twice and uses dynamic allocation of buffer, if the resulting string doesn't fit into 64 bytes. I would guess that a lot of printf uses have the result larger then 64 characters.
the proposed implementation writes to output the result of formatting directly with write(byte).
I use this implementation in StreamLib , a library for all architectures. This printf implementation works for xtensa and for ARM. For AVR the implementation with the same concept is slightly different. I use the StreamLib in my project with many different printfs. The project ran months on esp8266. Now it is on M0.
Activity
earlephilhower commentedon Jan 16, 2019
The suggested code snippet doesn't have any explanation or context. Nothing to do here. If you have a need for this, I suggest making a PR with an example or some explanation. Closing as an issue.
devyte commentedon Jan 17, 2019
@JAndrassy I also don't understand the intent here. If you provide a more detailed explanation and examples we can discus it.
JAndrassy commentedon Jan 17, 2019
current implementation of printf in Print in esp8266 core calls vsnprintf twice and uses dynamic allocation of buffer, if the resulting string doesn't fit into 64 bytes. I would guess that a lot of printf uses have the result larger then 64 characters.
the proposed implementation writes to output the result of formatting directly with write(byte).
I use this implementation in StreamLib , a library for all architectures. This printf implementation works for xtensa and for ARM. For AVR the implementation with the same concept is slightly different. I use the StreamLib in my project with many different printfs. The project ran months on esp8266. Now it is on M0.
In AVR core this way of implementation of printf was proposed but not merged yet.
u48 commentedon Feb 9, 2019
Hi.
The solution is correct, it will work fine.
I have already added a completely similar way of printf() in arduino STM32.
Works on STM32, ESP8266, DUE, Raspbery.
In my profile there is a fork Arduino Stm32. In the branch for Stm32F1 there is already a ready source print.с
Bonus, for Arduino Uno, too, there is a similar solution.