Do rounding in integer (instead of FIXFLOAT)

Co-Authored-By: Bob-the-Kuhn <bob-the-kuhn@users.noreply.github.com>
This commit is contained in:
Scott Lahteine
2018-04-29 19:14:18 -05:00
parent 616651ff23
commit 63e4afc910
3 changed files with 110 additions and 113 deletions

View File

@@ -87,14 +87,14 @@ void safe_delay(millis_t ms);
char* ftostr62rj(const float &x);
// Convert float to rj string with 123 or -12 format
FORCE_INLINE char* ftostr3(const float &x) { return itostr3(int(FIXFLOAT(x))); }
FORCE_INLINE char* ftostr3(const float &x) { return itostr3(int(x + (x < 0 ? -0.5 : 0.5))); }
#if ENABLED(LCD_DECIMAL_SMALL_XY)
// Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format
char* ftostr4sign(const float &fx);
#else
// Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format
FORCE_INLINE char* ftostr4sign(const float &x) { return itostr4sign(int(FIXFLOAT(x))); }
FORCE_INLINE char* ftostr4sign(const float &x) { return itostr4sign(int(x + (x < 0 ? -0.5 : 0.5))); }
#endif
#endif // ULTRA_LCD