More decimal places for babystep / Z probe offset (#17195)

This commit is contained in:
Joe Prints
2020-03-17 15:12:52 -05:00
committed by GitHub
parent e8205af6fb
commit 1f5824247f
8 changed files with 54 additions and 34 deletions

View File

@ -174,9 +174,9 @@ const char* ftostr12ns(const float &f) {
return &conv[3];
}
// Convert signed float to fixed-length string with 12.34 / -2.34 or 023.45 / -23.45 format
// Convert signed float to fixed-length string with 12.34 / _2.34 / -2.34 or -23.45 / 123.45 format
const char* ftostr42_52(const float &f) {
if (f <= -10 || f >= 100) return ftostr52(f); // need more digits
if (f <= -10 || f >= 100) return ftostr52(f); // -23.45 / 123.45
long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;
conv[2] = (f >= 0 && f < 10) ? ' ' : MINUSOR(i, DIGIMOD(i, 1000));
conv[3] = DIGIMOD(i, 100);
@ -198,9 +198,9 @@ const char* ftostr52(const float &f) {
return &conv[1];
}
// Convert signed float to fixed-length string with 12.345 / -2.345 or 023.456 / -23.456 format
const char* ftostr43_53(const float &f) {
if (f <= -10 || f >= 100) return ftostr53(f); // need more digits
// Convert signed float to fixed-length string with 12.345 / _2.345 / -2.345 or -23.45 / 123.45 format
const char* ftostr53_63(const float &f) {
if (f <= -10 || f >= 100) return ftostr63(f); // -23.456 / 123.456
long i = (f * 10000 + (f < 0 ? -5: 5)) / 10;
conv[1] = (f >= 0 && f < 10) ? ' ' : MINUSOR(i, DIGIMOD(i, 10000));
conv[2] = DIGIMOD(i, 1000);
@ -212,7 +212,7 @@ const char* ftostr43_53(const float &f) {
}
// Convert signed float to fixed-length string with 023.456 / -23.456 format
const char* ftostr53(const float &f) {
const char* ftostr63(const float &f) {
long i = (f * 10000 + (f < 0 ? -5: 5)) / 10;
conv[0] = MINUSOR(i, DIGIMOD(i, 100000));
conv[1] = DIGIMOD(i, 10000);
@ -310,6 +310,19 @@ const char* ftostr52sign(const float &f) {
return conv;
}
// Convert signed float to string with +12.345 format
const char* ftostr53sign(const float &f) {
long i = (f * 1000 + (f < 0 ? -5: 5)) / 10;
conv[0] = MINUSOR(i, '+');
conv[1] = DIGIMOD(i, 10000);
conv[2] = DIGIMOD(i, 1000);
conv[3] = '.';
conv[4] = DIGIMOD(i, 100);
conv[5] = DIGIMOD(i, 10);
conv[6] = DIGIMOD(i, 1);
return conv;
}
// Convert unsigned float to string with ____4.5, __34.5, _234.5, 1234.5 format
const char* ftostr51rj(const float &f) {
const long i = ((f < 0 ? -f : f) * 100 + 5) / 10;

View File

@ -58,17 +58,17 @@ const char* i16tostr4signrj(const int16_t x);
// Convert unsigned float to string with 1.23 format
const char* ftostr12ns(const float &x);
// Convert signed float to fixed-length string with 12.34 / -2.34 or 023.45 / -23.45 format
// Convert signed float to fixed-length string with 12.34 / _2.34 / -2.34 or -23.45 / 123.45 format
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);
const char* ftostr53_63(const float &x);
// Convert signed float to fixed-length string with 023.456 / -23.456 format
const char* ftostr53(const float &x);
const char* ftostr63(const float &x);
// Convert float to fixed-length string with +123.4 / -123.4 format
const char* ftostr41sign(const float &x);
@ -91,6 +91,9 @@ const char* ftostr52sp(const float &x);
// Convert signed float to string with +123.45 format
const char* ftostr52sign(const float &x);
// Convert signed float to string with +12.345 format
const char* ftostr53sign(const float &f);
// Convert unsigned float to string with 1234.5 format omitting trailing zeros
const char* ftostr51rj(const float &x);