Followup to num2str update (#15518)

This commit is contained in:
Haxk20 2019-10-11 15:45:15 +02:00 committed by Scott Lahteine
parent ac8083588b
commit 1df90aaf0e
2 changed files with 2 additions and 2 deletions

View File

@ -201,7 +201,7 @@ const char* ftostr52(const float &f) {
#if ENABLED(LCD_DECIMAL_SMALL_XY) #if ENABLED(LCD_DECIMAL_SMALL_XY)
// Convert float to rj string with 1234, _123, -123, _-12, 12.3, _1.2, or -1.2 format // Convert float to rj string with 1234, _123, -123, _-12, 12.3, _1.2, or -1.2 format
char* ftostr4sign(const float &f) { const char* ftostr4sign(const float &f) {
const int i = (f * 100 + (f < 0 ? -5: 5)) / 10; const int i = (f * 100 + (f < 0 ? -5: 5)) / 10;
if (!WITHIN(i, -99, 999)) return i16tostr4sign((int)f); if (!WITHIN(i, -99, 999)) return i16tostr4sign((int)f);
const bool neg = i < 0; const bool neg = i < 0;

View File

@ -97,7 +97,7 @@ FORCE_INLINE const char* ftostr3(const float &x) { return i16tostr3(int16_t(x +
#if ENABLED(LCD_DECIMAL_SMALL_XY) #if ENABLED(LCD_DECIMAL_SMALL_XY)
// Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format // Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format
char* ftostr4sign(const float &fx); const char* ftostr4sign(const float &fx);
#else #else
// Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format // Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format
FORCE_INLINE const char* ftostr4sign(const float &x) { return i16tostr4sign(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } FORCE_INLINE const char* ftostr4sign(const float &x) { return i16tostr4sign(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }