Skip to content

Printing floats in Zephyr #7

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
MarkoSagadin opened this issue Oct 20, 2020 · 4 comments · Fixed by #8
Closed

Printing floats in Zephyr #7

MarkoSagadin opened this issue Oct 20, 2020 · 4 comments · Fixed by #8

Comments

@MarkoSagadin
Copy link
Contributor

There is a bug (or maybe feature) in Zephyr with printf implementation: buffer will be sent over serial only after calling printf with newline character or when buffer fills up.

@VojislavM
Copy link
Member

printf and printk have differences in the implementation and separate buffers. So printk can push stuff without a new line, but printf cannot do that.

@MarkoSagadin
Copy link
Contributor Author

Current solution is to replace all printk calls with printf's, then it works, this can be seen in commit 8bac408.

We can consider this as a workaround, as people coming from Zephyr are used to printk, not printf.
If this presists we have to write it to README.

@VojislavM
Copy link
Member

bu adding this line to setup:

setvbuf(stdout, NULL, _IONBF, 0);

the printf output won't be buffered and will be printed immediately without a new line.
@MarkoSagadin

@VojislavM VojislavM linked a pull request Oct 20, 2020 that will close this issue
@MarkoSagadin
Copy link
Contributor Author

I implemented this in commit a95aab4, this solved the problem like you wrote.

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

Successfully merging a pull request may close this issue.

2 participants