From 72cdb485ff26ee72ad4ef7639cf3f8d93cf87dd2 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Tue, 26 May 2020 06:53:35 +0200 Subject: [PATCH] Display units better --- plot.c | 2 ++ sa_core.c | 25 ++++++++++++++++--------- ui_sa.c | 6 +----- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/plot.c b/plot.c index 09d0ef7..19741b8 100644 --- a/plot.c +++ b/plot.c @@ -2004,6 +2004,8 @@ static void cell_draw_marker_info(int x0, int y0) buf[k++] = i+'1'; if (markers[i].mtype & M_REFERENCE) buf[k++] = 'R'; + if (markers[i].mtype & M_TRACKING) + buf[k++] = 'T'; if (markers[i].mtype & M_DELTA) buf[k++] = 'D'; if (markers[i].mtype & M_NOISE) diff --git a/sa_core.c b/sa_core.c index 56b2a20..527634e 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1506,7 +1506,7 @@ float my_round(float v) return v; } -const char *unit_string[] = { "dBm", "dBmV", "dBuV", "V", "mW" }; +const char *unit_string[] = { "dBmW", "dBmV", "dBuV", "V", "mW" }; void draw_cal_status(void) { @@ -1535,9 +1535,9 @@ void draw_cal_status(void) float yMax = setting.reflevel; if (rounding) - plot_printf(buf, BLEN, "%d%s", (int)yMax, unit); + plot_printf(buf, BLEN, "%d", (int)yMax); else - plot_printf(buf, BLEN, "%f%s", yMax, unit); + plot_printf(buf, BLEN, "%f", yMax); buf[5]=0; if (level_is_calibrated()) { if (setting.auto_reflevel) @@ -1550,13 +1550,19 @@ void draw_cal_status(void) ili9341_set_foreground(color); ili9341_drawstring(buf, x, y); + color = DEFAULT_FG_COLOR; + ili9341_set_foreground(color); + y += YSTEP + YSTEP/2 ; + plot_printf(buf, BLEN, "%s",unit); + ili9341_drawstring(buf, x, y); + color = DEFAULT_FG_COLOR; ili9341_set_foreground(color); y += YSTEP + YSTEP/2 ; if (rounding) - plot_printf(buf, BLEN, "%d%s/",(int)setting.scale, unit); + plot_printf(buf, BLEN, "%d/",(int)setting.scale); else - plot_printf(buf, BLEN, "%f%s/",setting.scale, unit); + plot_printf(buf, BLEN, "%f/",setting.scale); ili9341_drawstring(buf, x, y); if (setting.auto_attenuation) @@ -1696,9 +1702,9 @@ void draw_cal_status(void) y = HEIGHT-7 + OFFSETY; if (rounding) - plot_printf(buf, BLEN, "%d%s", (int)(yMax - setting.scale * NGRIDY), unit); + plot_printf(buf, BLEN, "%d", (int)(yMax - setting.scale * NGRIDY)); else - plot_printf(buf, BLEN, "%f%s", (yMax - setting.scale * NGRIDY), unit); + plot_printf(buf, BLEN, "%f", (yMax - setting.scale * NGRIDY)); buf[5]=0; if (level_is_calibrated()) if (setting.auto_reflevel) @@ -1850,18 +1856,19 @@ int validate_peak_below(int i, float margin) { int validate_below(int tc, int from, int to) { int status = TS_PASS; + float threshold=stored_t[from]; float sum = 0; int sum_count = 0; for (int j = from; j < to; j++) { sum += actual_t[j]; sum_count++; - if (actual_t[j] > stored_t[j]) { + if (actual_t[j] > threshold) { status = TS_FAIL; break; } } sum = sum / sum_count; - if (sum > stored_t[from] - 5) + if (sum > threshold - 5) status = TS_CRITICAL; if (status != TS_PASS) test_fail_cause[tc] = "Above "; diff --git a/ui_sa.c b/ui_sa.c index f59e99f..a092afe 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1369,7 +1369,7 @@ static const menuitem_t menu_displayhigh[] = { static const menuitem_t menu_unit[] = { - { MT_CALLBACK,U_DBM, "dBm", menu_unit_cb}, + { MT_CALLBACK,U_DBM, "dBmW", menu_unit_cb}, { MT_CALLBACK,U_DBMV, "dBmV", menu_unit_cb}, { MT_CALLBACK,U_DBUV, "dBuV", menu_unit_cb}, { MT_CALLBACK,U_VOLT, "Volt", menu_unit_cb}, @@ -1608,10 +1608,6 @@ static void menu_item_modify_attribute( else if (item < 5 && data==markers[active_marker].mtype) // This catches the M_NORMAL case mark = true; } else if (menu == menu_marker_search) { - if (item == 0 && search_is_greater()) - mark = true; - if (item == 1 && !search_is_greater()) - mark = true; if (item == 4 && markers[active_marker].mtype & M_TRACKING) mark = true; } else if (menu == menu_marker_sel || menu == menu_marker_select) {