From 7a616786ca40f05b74eee55bf7f85e5e417ddb89 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Mon, 8 Jun 2020 11:35:50 +0200 Subject: [PATCH] Rounding and extra market digit --- plot.c | 15 ++++++++------- sa_core.c | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plot.c b/plot.c index ed0b251..38528da 100644 --- a/plot.c +++ b/plot.c @@ -849,7 +849,7 @@ static void trace_get_value_string( (void) point_count; float v; char buf2[11]; - char buf3[6]; + char buf3[8]; buf2[0]=' '; uint32_t dfreq = 0; float rlevel = 0; @@ -905,14 +905,15 @@ static void trace_get_value_string( else { v = v - rlevel; if (UNIT_IS_LINEAR(setting.unit)) { - if (v < 100000) - plot_printf(buf3, sizeof(buf3), "%5f", v); + if (v < 1000000) + plot_printf(buf3, sizeof(buf3), "%6f", v); else - strcpy(buf3,"*****"); - } - else + strcpy(buf3,"******"); + buf3[6] = 0; + } else { plot_printf(buf3, sizeof(buf3), "%5.1f", v); - buf3[5] = 0; + buf3[5] = 0; + } plot_printf(buf, len, "%s %s%s%s", buf2, buf3,unit_string[setting.unit],(mtype & M_NOISE?"/Hz":"")); } } diff --git a/sa_core.c b/sa_core.c index 0e4b69d..180e3da 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1816,7 +1816,7 @@ void draw_cal_status(void) if (rounding) plot_printf(buf, BLEN, "%6d", (int)yMax); else - plot_printf(buf, BLEN, "%6f", yMax); + plot_printf(buf, BLEN, "%6f", yMax+0.00005); buf[6]=0; if (level_is_calibrated()) { if (setting.auto_reflevel) @@ -2054,7 +2054,7 @@ void draw_cal_status(void) if (rounding) plot_printf(buf, BLEN, "%6d", (int)(yMax - setting.scale * NGRIDY)); else - plot_printf(buf, BLEN, "%6f", (yMax - setting.scale * NGRIDY)); + plot_printf(buf, BLEN, "%6f", (yMax - setting.scale * NGRIDY)+0.00005); buf[6]=0; if (level_is_calibrated()) if (setting.auto_reflevel)