Browse Source

🚸 12345.6 num-to-string

Scott Lahteine 2 years ago
parent
commit
755c196cfa

+ 1
- 1
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

674
         #if CUTTER_UNIT_IS(PERCENT)
674
         #if CUTTER_UNIT_IS(PERCENT)
675
           lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
675
           lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
676
         #elif CUTTER_UNIT_IS(RPM)
676
         #elif CUTTER_UNIT_IS(RPM)
677
-          lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr51rj(float(cutter.unitPower) / 1000));
677
+          lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
678
           lcd_put_wchar('K');
678
           lcd_put_wchar('K');
679
         #else
679
         #else
680
           lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
680
           lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));

+ 1
- 1
Marlin/src/lcd/menu/menu_item.h View File

150
 DEFINE_MENU_EDIT_ITEM_TYPE(float4      ,float    ,ftostr4sign     ,   1     );   // 1234       right-justified
150
 DEFINE_MENU_EDIT_ITEM_TYPE(float4      ,float    ,ftostr4sign     ,   1     );   // 1234       right-justified
151
 DEFINE_MENU_EDIT_ITEM_TYPE(float5      ,float    ,ftostr5rj       ,   1     );   // 12345      right-justified
151
 DEFINE_MENU_EDIT_ITEM_TYPE(float5      ,float    ,ftostr5rj       ,   1     );   // 12345      right-justified
152
 DEFINE_MENU_EDIT_ITEM_TYPE(float5_25   ,float    ,ftostr5rj       ,   0.04f );   // 12345      right-justified (25 increment)
152
 DEFINE_MENU_EDIT_ITEM_TYPE(float5_25   ,float    ,ftostr5rj       ,   0.04f );   // 12345      right-justified (25 increment)
153
-DEFINE_MENU_EDIT_ITEM_TYPE(float51     ,float    ,ftostr51rj      ,  10     );   // 1234.5     right-justified
153
+DEFINE_MENU_EDIT_ITEM_TYPE(float61     ,float    ,ftostr61rj      ,  10     );   // 12345.6    right-justified
154
 DEFINE_MENU_EDIT_ITEM_TYPE(float31sign ,float    ,ftostr31sign    ,  10     );   // +12.3
154
 DEFINE_MENU_EDIT_ITEM_TYPE(float31sign ,float    ,ftostr31sign    ,  10     );   // +12.3
155
 DEFINE_MENU_EDIT_ITEM_TYPE(float41sign ,float    ,ftostr41sign    ,  10     );   // +123.4
155
 DEFINE_MENU_EDIT_ITEM_TYPE(float41sign ,float    ,ftostr41sign    ,  10     );   // +123.4
156
 DEFINE_MENU_EDIT_ITEM_TYPE(float51sign ,float    ,ftostr51sign    ,  10     );   // +1234.5
156
 DEFINE_MENU_EDIT_ITEM_TYPE(float51sign ,float    ,ftostr51sign    ,  10     );   // +1234.5

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

377
   return conv;
377
   return conv;
378
 }
378
 }
379
 
379
 
380
-// Convert unsigned float to string with ____4.5, __34.5, _234.5, 1234.5 format
381
-const char* ftostr51rj(const_float_t f) {
380
+// Convert unsigned float to string with ____5.6, ___45.6, __345.6, _2345.6, 12345.6 format
381
+const char* ftostr61rj(const_float_t f) {
382
   const long i = UINTFLOAT(f, 1);
382
   const long i = UINTFLOAT(f, 1);
383
-  conv[0] = ' ';
383
+  conv[0] = RJDIGIT(i, 100000);
384
   conv[1] = RJDIGIT(i, 10000);
384
   conv[1] = RJDIGIT(i, 10000);
385
   conv[2] = RJDIGIT(i, 1000);
385
   conv[2] = RJDIGIT(i, 1000);
386
   conv[3] = RJDIGIT(i, 100);
386
   conv[3] = RJDIGIT(i, 100);

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

113
 // Convert signed float to string with +12.345 format
113
 // Convert signed float to string with +12.345 format
114
 const char* ftostr53sign(const_float_t f);
114
 const char* ftostr53sign(const_float_t f);
115
 
115
 
116
-// Convert unsigned float to string with 1234.5 format omitting trailing zeros
117
-const char* ftostr51rj(const_float_t x);
116
+// Convert unsigned float to string with 12345.6 format omitting trailing zeros
117
+const char* ftostr61rj(const_float_t x);
118
 
118
 
119
 // Convert float to rj string with 123 or -12 format
119
 // Convert float to rj string with 123 or -12 format
120
 FORCE_INLINE const char* ftostr3(const_float_t x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
120
 FORCE_INLINE const char* ftostr3(const_float_t x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }

Loading…
Cancel
Save