|
|
|
@ -6706,33 +6706,28 @@ void display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign |
|
|
|
|
void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign) |
|
|
|
|
{ |
|
|
|
|
char s[LCD_cols + 1]; |
|
|
|
|
char f[LCD_cols + 1]; |
|
|
|
|
|
|
|
|
|
if (size_fraction > 0) |
|
|
|
|
{ |
|
|
|
|
if (zeros == true && sign == true) |
|
|
|
|
sprintf(f, "%%+0%d.%df", size_number + size_fraction + 2, size_fraction); |
|
|
|
|
sprintf(s, "%+0*.*f", size_number + size_fraction + 2, size_fraction, var); |
|
|
|
|
else if (zeros == true && sign == false) |
|
|
|
|
sprintf(f, "%%+0%d.%df", size_number + size_fraction + 1, size_fraction); |
|
|
|
|
sprintf(s, "%0*.*f", size_number + size_fraction + 1, size_fraction, var); |
|
|
|
|
else if (zeros == false && sign == true) |
|
|
|
|
sprintf(f, "%%+%d.%df", size_number + size_fraction + 2, size_fraction); |
|
|
|
|
sprintf(s, "%+*.*f", size_number + size_fraction + 2, size_fraction, var); |
|
|
|
|
else if (zeros == false && sign == false) |
|
|
|
|
sprintf(f, "%%%d.%df", size_number + size_fraction + 1, size_fraction); |
|
|
|
|
|
|
|
|
|
sprintf(s, f, var); |
|
|
|
|
sprintf(s, "%*.*f", size_number + size_fraction + 1, size_fraction, var); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (zeros == true && sign == true) |
|
|
|
|
sprintf(f, "%%+0%dd", size_number + 1); |
|
|
|
|
sprintf(s, "%+0*d", size_number + 1, var); |
|
|
|
|
else if (zeros == true && sign == false) |
|
|
|
|
sprintf(f, "%%%0dd", size_number); |
|
|
|
|
sprintf(s, "%0*d", size_number, var); |
|
|
|
|
else if (zeros == false && sign == true) |
|
|
|
|
sprintf(f, "%%+%dd", size_number + 1); |
|
|
|
|
sprintf(s, "%+*d", size_number + 1, var); |
|
|
|
|
else if (zeros == false && sign == false) |
|
|
|
|
sprintf(f, "%%%dd", size_number); |
|
|
|
|
|
|
|
|
|
sprintf(s, f, int(var)); |
|
|
|
|
sprintf(s, "%*d", size_number, var); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (brackets == true) |
|
|
|
@ -6744,7 +6739,6 @@ void display_float(float var, uint8_t size_number, uint8_t size_fraction, bool z |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Serial.println(var); |
|
|
|
|
Serial.println(f); |
|
|
|
|
Serial.println(s); |
|
|
|
|
|
|
|
|
|
display.print(s); |
|
|
|
|