From e77359b6acdb84b17f81546dcaf59ac35d938d9c Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 27 May 2020 20:26:21 +0200 Subject: [PATCH] Small UI improvements --- plot.c | 2 +- sa_core.c | 11 +++++++---- ui_sa.c | 12 ++++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/plot.c b/plot.c index 4c1d5e2..5de3227 100644 --- a/plot.c +++ b/plot.c @@ -846,7 +846,7 @@ static void trace_get_value_string( plot_printf(buf, len, "-INF"); else { if (setting.unit) - plot_printf(buf, len, "%s %.5f%s%s", buf2, v - rlevel,unit_string[setting.unit],(mtype & M_NOISE?"/Hz":"")); + plot_printf(buf, len, "%s %.2f%s%s", buf2, v - rlevel,unit_string[setting.unit],(mtype & M_NOISE?"/Hz":"")); else plot_printf(buf, len, "%s %.1f%s%s", buf2, v - rlevel,unit_string[setting.unit],(mtype & M_NOISE?"/Hz":"")); } diff --git a/sa_core.c b/sa_core.c index ad513d9..7a7066a 100644 --- a/sa_core.c +++ b/sa_core.c @@ -194,6 +194,9 @@ void set_IF(int f) void set_unit(int u) { + if (UNIT_IS_LINEAR(setting.unit) && !UNIT_IS_LINEAR(u)) { + set_scale(10); + } setting.unit = u; dirty = true; } @@ -1175,7 +1178,7 @@ again: if (setting.subtract_stored) { RSSI = RSSI - stored_t[i] ; } - // stored_t[i] = (SI4432_Read_Byte(0x69) & 0x0f) * 3.0 - 90.0; // Display the AGC value in thestored trace + stored_t[i] = (SI4432_Read_Byte(0x69) & 0x0f) * 3.0 - 90.0; // Display the AGC value in thestored trace if (scandirty || setting.average == AV_OFF) { // Level calculations actual_t[i] = RSSI; age[i] = 0; @@ -1586,7 +1589,7 @@ void draw_cal_status(void) if (rounding) plot_printf(buf, BLEN, "%d", (int)yMax); else - plot_printf(buf, BLEN, "%f", yMax); + plot_printf(buf, BLEN, "%.2f", yMax); buf[5]=0; if (level_is_calibrated()) { if (setting.auto_reflevel) @@ -1611,7 +1614,7 @@ void draw_cal_status(void) if (rounding) plot_printf(buf, BLEN, "%d/",(int)setting.scale); else - plot_printf(buf, BLEN, "%f/",setting.scale); + plot_printf(buf, BLEN, "%.2f/",setting.scale); ili9341_drawstring(buf, x, y); if (setting.auto_attenuation) @@ -1753,7 +1756,7 @@ void draw_cal_status(void) if (rounding) plot_printf(buf, BLEN, "%d", (int)(yMax - setting.scale * NGRIDY)); else - plot_printf(buf, BLEN, "%f", (yMax - setting.scale * NGRIDY)); + plot_printf(buf, BLEN, "%.2f", (yMax - setting.scale * NGRIDY)); buf[5]=0; if (level_is_calibrated()) if (setting.auto_reflevel) diff --git a/ui_sa.c b/ui_sa.c index 8114b0e..c4e145e 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1384,7 +1384,7 @@ static const menuitem_t menu_levelhigh[] = { { MT_SUBMENU, 0, "\2REF\0LEVEL", menu_reflevel}, // { MT_SUBMENU, 0, "\2SCALE/\0DIV",menu_scale_per}, { MT_KEYPAD, KM_SCALE, "\2SCALE/\0DIV", NULL}, - { MT_SUBMENU,0, "AVER", menu_average}, + { MT_SUBMENU,0, "CALC", menu_average}, { MT_SUBMENU, 0, "UNIT", menu_unit}, { MT_KEYPAD, KM_OFFSET, "\2EXTERN\0AMP", NULL}, { MT_SUBMENU, 0, "TRIGGER", menu_trigger}, @@ -1396,12 +1396,12 @@ static const menuitem_t menu_levelhigh[] = { static const menuitem_t menu_level[] = { { MT_SUBMENU, 0, "\2REF\0LEVEL", menu_reflevel}, // { MT_SUBMENU, 0, "\2SCALE/\0DIV",menu_scale_per}, - { MT_KEYPAD, KM_SCALE, "\2SCALE/\0DIV", NULL}, - { MT_SUBMENU | MT_LOW, 0, "ATTEN", menu_atten}, - { MT_SUBMENU,0, "AVER", menu_average}, + { MT_KEYPAD, KM_SCALE, "\2SCALE/\0DIV",NULL}, + { MT_SUBMENU | MT_LOW, 0, "ATTEN", menu_atten}, + { MT_SUBMENU,0, "CALC", menu_average}, { MT_SUBMENU, 0, "UNIT", menu_unit}, - { MT_KEYPAD, KM_OFFSET, "\2EXTERN\0AMP", NULL}, - { MT_SUBMENU, 0, "TRIGGER", menu_trigger}, + { MT_KEYPAD, KM_OFFSET, "\2EXTERN\0AMP",NULL}, + { MT_SUBMENU, 0, "TRIGGER", menu_trigger}, { MT_CANCEL, 0, S_LARROW" BACK",NULL }, { MT_NONE, 0, NULL, NULL } // sentinel };