Additional numtostr functions
This commit is contained in:
@@ -24,13 +24,13 @@
|
||||
#include <stdint.h>
|
||||
|
||||
// Convert a full-range unsigned 8bit int to a percentage
|
||||
const char* ui8tostr4pct(const uint8_t i);
|
||||
const char* ui8tostr4pctrj(const uint8_t i);
|
||||
|
||||
// Convert uint8_t to string with 123 format
|
||||
const char* ui8tostr3(const uint8_t i);
|
||||
const char* ui8tostr3rj(const uint8_t i);
|
||||
|
||||
// Convert int8_t to string with 123 format
|
||||
const char* i8tostr3(const int8_t x);
|
||||
const char* i8tostr3rj(const int8_t x);
|
||||
|
||||
#if HAS_PRINT_PROGRESS_PERMYRIAD
|
||||
// Convert 16-bit unsigned permyriad value to percent: 100 / 23 / 23.4 / 3.45
|
||||
@@ -38,22 +38,22 @@ const char* i8tostr3(const int8_t x);
|
||||
#endif
|
||||
|
||||
// Convert uint16_t to string with 12345 format
|
||||
const char* ui16tostr5(const uint16_t x);
|
||||
const char* ui16tostr5rj(const uint16_t x);
|
||||
|
||||
// Convert uint16_t to string with 1234 format
|
||||
const char* ui16tostr4(const uint16_t x);
|
||||
const char* ui16tostr4rj(const uint16_t x);
|
||||
|
||||
// Convert uint16_t to string with 123 format
|
||||
const char* ui16tostr3(const uint16_t x);
|
||||
const char* ui16tostr3rj(const uint16_t x);
|
||||
|
||||
// Convert int16_t to string with 123 format
|
||||
const char* i16tostr3(const int16_t x);
|
||||
const char* i16tostr3rj(const int16_t x);
|
||||
|
||||
// Convert unsigned int to lj string with 123 format
|
||||
const char* i16tostr3left(const int16_t xx);
|
||||
|
||||
// Convert signed int to rj string with _123, -123, _-12, or __-1 format
|
||||
const char* i16tostr4sign(const int16_t x);
|
||||
const char* i16tostr4signrj(const int16_t x);
|
||||
|
||||
// Convert unsigned float to string with 1.23 format
|
||||
const char* ftostr12ns(const float &x);
|
||||
@@ -64,6 +64,12 @@ const char* ftostr42_52(const float &x);
|
||||
// Convert signed float to fixed-length string with 023.45 / -23.45 format
|
||||
const char* ftostr52(const float &x);
|
||||
|
||||
// Convert signed float to fixed-length string with 12.345 / -2.345 or 023.456 / -23.456 format
|
||||
const char* ftostr43_53(const float &x);
|
||||
|
||||
// Convert signed float to fixed-length string with 023.456 / -23.456 format
|
||||
const char* ftostr53(const float &x);
|
||||
|
||||
// Convert float to fixed-length string with +123.4 / -123.4 format
|
||||
const char* ftostr41sign(const float &x);
|
||||
|
||||
@@ -91,7 +97,7 @@ const char* ftostr51rj(const float &x);
|
||||
#include "../core/macros.h"
|
||||
|
||||
// Convert float to rj string with 123 or -12 format
|
||||
FORCE_INLINE const char* ftostr3(const float &x) { return i16tostr3(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
|
||||
FORCE_INLINE const char* ftostr3(const float &x) { return i16tostr3rj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -100,5 +106,5 @@ FORCE_INLINE const char* ftostr3(const float &x) { return i16tostr3(int16_t(x +
|
||||
const char* ftostr4sign(const float &fx);
|
||||
#else
|
||||
// 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 i16tostr4signrj(int16_t(x + (x < 0 ? -0.5f : 0.5f))); }
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user