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

Serial.println(String(0.3f)) outputs nothing #10

Closed
pablosun opened this issue May 12, 2017 · 1 comment
Closed

Serial.println(String(0.3f)) outputs nothing #10

pablosun opened this issue May 12, 2017 · 1 comment
Assignees
Labels

Comments

@pablosun
Copy link
Contributor

pablosun commented May 12, 2017

Serial.println(0.3f);  // OK, output "0.30"
Serial.println(String(0.3f)); // NG, output ""

Reference: https://labs.mediatek.com/en/faq/FAQ18719

@pablosun pablosun added the bug label May 12, 2017
@pablosun pablosun self-assigned this May 12, 2017
pablosun added a commit that referenced this issue May 12, 2017
Fix `Serial.print(1.3f)` results in empty output issue by adding `-u _printf_flat` in `ldfalgs`.
@pablosun pablosun changed the title Serial.println(0.3f) outputs nothing Serial.println(String(0.3f)) outputs nothing May 12, 2017
@pablosun
Copy link
Contributor Author

Note that Stream::print implement its own floating-point output implementation, while String(float) redirects the call to dtostrf and then vsprintf. So a quick solution is to add the floating point support to the printf library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant