Remove trailling zero at %F format

Fix some format output
pull/4/head
DiSlord 6 years ago
parent 5a46a6486f
commit bfa392da02

@ -204,6 +204,9 @@ static char *ftoaS(char *p, float num, int precision) {
if (precision<0) if (precision<0)
precision=0; precision=0;
p=ftoa(p, num, precision); p=ftoa(p, num, precision);
// remove zeros at end
while (p[-1]=='0') p--;
if (p[-1]=='.') p--;
if (prefix) if (prefix)
*p++ = prefix; *p++ = prefix;
return p; return p;

@ -2330,7 +2330,7 @@ void draw_cal_status(void)
if (rounding) if (rounding)
plot_printf(buf, BLEN, "%+4d", (int)yMax); plot_printf(buf, BLEN, "%+4d", (int)yMax);
else else
plot_printf(buf, BLEN, "%+.3F", (yMax/setting.unit_scale)); plot_printf(buf, BLEN, "%+4.3F", (yMax/setting.unit_scale));
if (level_is_calibrated()) { if (level_is_calibrated()) {
if (setting.auto_reflevel) if (setting.auto_reflevel)
@ -2464,10 +2464,10 @@ void draw_cal_status(void)
ili9341_drawstring(buf, x, y); ili9341_drawstring(buf, x, y);
y += YSTEP; y += YSTEP;
plot_printf(buf, BLEN, "%.3Fs", (float)setting.sweep_time_us/ONE_SECOND_TIME); plot_printf(buf, BLEN, "%5.3Fs", (float)setting.sweep_time_us/ONE_SECOND_TIME);
ili9341_drawstring(buf, x, y); ili9341_drawstring(buf, x, y);
y += YSTEP; y += YSTEP;
plot_printf(buf, BLEN, "%.3Fs", (float)setting.actual_sweep_time_us/ONE_SECOND_TIME); plot_printf(buf, BLEN, "%5.3Fs", (float)setting.actual_sweep_time_us/ONE_SECOND_TIME);
ili9341_drawstring(buf, x, y); ili9341_drawstring(buf, x, y);
#if 1 #if 1
y += YSTEP; y += YSTEP;
@ -2477,10 +2477,10 @@ void draw_cal_status(void)
// if (t < setting.sweep_time_us) // if (t < setting.sweep_time_us)
// t = setting.sweep_time_us; // t = setting.sweep_time_us;
// setting.actual_sweep_time_us = t; // setting.actual_sweep_time_us = t;
plot_printf(buf, BLEN, "%.3Fs", (float)t/ONE_SECOND_TIME); plot_printf(buf, BLEN, "%5.3Fs", (float)t/ONE_SECOND_TIME);
ili9341_drawstring(buf, x, y); ili9341_drawstring(buf, x, y);
y += YSTEP; y += YSTEP;
plot_printf(buf, BLEN, "%.3Fs", (float)setting.additional_step_delay_us/ONE_SECOND_TIME); plot_printf(buf, BLEN, "%5.3Fs", (float)setting.additional_step_delay_us/ONE_SECOND_TIME);
ili9341_drawstring(buf, x, y); ili9341_drawstring(buf, x, y);
#endif #endif
@ -2587,11 +2587,11 @@ void draw_cal_status(void)
// ili9341_set_background(DEFAULT_BG_COLOR); // ili9341_set_background(DEFAULT_BG_COLOR);
// Bottom level // Bottom level
y = area_height - 7 + OFFSETY; y = area_height - 8 + OFFSETY;
if (rounding) if (rounding)
plot_printf(buf, BLEN, "%4d", (int)(yMax - setting.scale * NGRIDY)); plot_printf(buf, BLEN, "%4d", (int)(yMax - setting.scale * NGRIDY));
else else
plot_printf(buf, BLEN, "%.3F", ((yMax - setting.scale * NGRIDY)/setting.unit_scale)); plot_printf(buf, BLEN, "%+4.3F", ((yMax - setting.scale * NGRIDY)/setting.unit_scale));
// buf[5]=0; // buf[5]=0;
if (level_is_calibrated()) if (level_is_calibrated())
if (setting.auto_reflevel) if (setting.auto_reflevel)

Loading…
Cancel
Save

Powered by TurnKey Linux.