From a5dff1a84adb80b1b31b407b193621abf65e1f52 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 7 Jun 2020 16:35:08 +0200 Subject: [PATCH] Time grid added and time resolution updated --- plot.c | 27 ++++++++++++++++----------- sa_core.c | 12 +++++++----- ui_sa.c | 1 + 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/plot.c b/plot.c index 3a4a436..d8a53fc 100644 --- a/plot.c +++ b/plot.c @@ -116,6 +116,11 @@ void update_grid(void) uint32_t fspan = get_sweep_frequency(ST_SPAN); uint32_t grid; + if (fspan == 0) { + fspan = setting.sweep_time*1000000 + 25000; // Time in uS + fstart = 0; + } + while (gdigit > 100) { grid = 5 * gdigit; if (fspan / grid >= 4) @@ -865,21 +870,21 @@ static void trace_get_value_string( if (FREQ_IS_CW()) { float t = ii*(setting.sweep_time*1000000 + 25000)/290; if (t>1000000.0){ - plot_printf(&buf2[1], sizeof(buf2) -1, "%5f" , t/1000000.0); - buf2[6] = 'S'; - buf2[7]=0; + plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/1000000.0); + buf2[5] = 'S'; + buf2[6]=0; } else if (t>1000.0) { - plot_printf(&buf2[1], sizeof(buf2) -1, "%5f" , t/1000.0); - buf2[6] = 'm'; - buf2[7] = 'S'; - buf2[8]=0; + plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/1000.0); + buf2[5] = 'm'; + buf2[6] = 'S'; + buf2[7]=0; } else { - plot_printf(&buf2[1], sizeof(buf2) -1, "%5f" , t); - buf2[6] = 'u'; - buf2[7] = 'S'; - buf2[8]=0; + plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t); + buf2[5] = 'u'; + buf2[6] = 'S'; + buf2[7]=0; } } else { uint32_t resolution = get_sweep_frequency(ST_SPAN)/290; diff --git a/sa_core.c b/sa_core.c index e657940..09041b1 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1934,12 +1934,14 @@ void draw_cal_status(void) #endif ; // in mS if (t>=10000.0) - plot_printf(buf, BLEN, "%5dS",(int)t); + plot_printf(buf, BLEN, "%5d",(int)(t/1000)); else if (t>=1000) - plot_printf(buf, BLEN, "%5fS",t); - else - plot_printf(buf, BLEN, "%dmS",(int)t); - + plot_printf(buf, BLEN, "%5f",t/1000.0); + else { + plot_printf(buf, BLEN, "%4dm",(int)t); + buf[4] = 'm'; + } + buf[5]='S'; buf[6]=0; ili9341_drawstring(buf, x, y); diff --git a/ui_sa.c b/ui_sa.c index 4f94172..49b5442 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1850,6 +1850,7 @@ set_numeric_value(void) break; case KM_SWEEP_TIME: set_sweep_time(uistat.value); + update_grid(); break; case KM_TRIGGER: set_trigger_level(to_dBm(uistat.value));