Browse Source

Followup to num2str update (#15518)

Haxk20 5 years ago
parent
commit
1df90aaf0e
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      Marlin/src/libs/numtostr.cpp
  2. 1
    1
      Marlin/src/libs/numtostr.h

+ 1
- 1
Marlin/src/libs/numtostr.cpp View File

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

+ 1
- 1
Marlin/src/libs/numtostr.h View File

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

Loading…
Cancel
Save