From 75ea464c91310de1eb826b14fc6a6753dc51ba58 Mon Sep 17 00:00:00 2001 From: TT Date: Sat, 30 Nov 2019 13:47:34 +0900 Subject: [PATCH] chore: delta symbol --- nanovna.h | 1 + plot.c | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nanovna.h b/nanovna.h index 7076a332..70282284 100644 --- a/nanovna.h +++ b/nanovna.h @@ -144,6 +144,7 @@ extern int area_height; extern const uint8_t x5x7_bits []; extern const uint8_t numfont20x22[][22 * 3]; +#define S_DELTA "\004" #define S_PI "\034" #define S_MICRO "\035" #define S_OHM "\036" diff --git a/plot.c b/plot.c index 9727b2d4..69c9ee66 100644 --- a/plot.c +++ b/plot.c @@ -756,13 +756,13 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[101][2], int case TRC_LOGMAG: v = logmag(coeff) - logmag(coeff_ref); if (v == -INFINITY) - chsnprintf(buf, len, "\004-INF dB"); + chsnprintf(buf, len, S_DELTA "-INF dB"); else - chsnprintf(buf, len, "\004%.2fdB", v); + chsnprintf(buf, len, S_DELTA "%.2fdB", v); break; case TRC_PHASE: v = phase(coeff) - phase(coeff_ref); - chsnprintf(buf, len, "\004%.2f" S_DEGREE, v); + chsnprintf(buf, len, S_DELTA "%.2f" S_DEGREE, v); break; case TRC_DELAY: v = groupdelay_from_array(index, array) - groupdelay_from_array(index_ref, array); @@ -770,20 +770,20 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[101][2], int break; case TRC_LINEAR: v = linear(coeff) - linear(coeff_ref); - chsnprintf(buf, len, "\004%.2f", v); + chsnprintf(buf, len, S_DELTA "%.2f", v); break; case TRC_SWR: v = swr(coeff) - swr(coeff_ref); - chsnprintf(buf, len, "\004%.2f", v); + chsnprintf(buf, len, S_DELTA "%.2f", v); break; case TRC_SMITH: format_smith_value(buf, len, coeff, frequencies[index]); break; case TRC_REAL: - chsnprintf(buf, len, "\004%.2f", coeff[0] - coeff_ref[0]); + chsnprintf(buf, len, S_DELTA "%.2f", coeff[0] - coeff_ref[0]); break; case TRC_IMAG: - chsnprintf(buf, len, "\004%.2fj", coeff[1] - coeff_ref[1]); + chsnprintf(buf, len, S_DELTA "%.2fj", coeff[1] - coeff_ref[1]); break; case TRC_R: gamma2resistance(buf, len, coeff); @@ -1594,7 +1594,7 @@ cell_draw_marker_info(int m, int n, int w, int h) int32_t freq = frequencies[markers[mk].index]; if (uistat.marker_delta && mk != active_marker) { freq -= frequencies[markers[active_marker].index]; - frequency_string_short(buf, sizeof buf, freq, '\004'); + frequency_string_short(buf, sizeof buf, freq, S_DELTA[0]); } else { frequency_string_short(buf, sizeof buf, freq, 0); } @@ -1615,7 +1615,8 @@ cell_draw_marker_info(int m, int n, int w, int h) int ypos = 1 + (j/2)*7; xpos -= m * CELLWIDTH -CELLOFFSETX; ypos -= n * CELLHEIGHT; - chsnprintf(buf, sizeof buf, "\004%d:", previous_marker+1); + strcpy(buf, S_DELTA "1:"); + buf[1] += previous_marker; cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff); xpos += 19; if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { @@ -1655,7 +1656,8 @@ cell_draw_marker_info(int m, int n, int w, int h) int ypos = 1 + (j/2)*7; xpos -= m * CELLWIDTH -CELLOFFSETX; ypos -= n * CELLHEIGHT; - chsnprintf(buf, sizeof buf, "%d:", active_marker + 1); + strcpy(buf, "1:"); + buf[0] += active_marker; xpos += 5; cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, 0xffff, uistat.lever_mode == LM_MARKER); xpos += 14;