chore: delta symbol

This commit is contained in:
TT 2019-11-30 13:47:34 +09:00
parent 481fa990db
commit 75ea464c91
2 changed files with 13 additions and 10 deletions

View file

@ -144,6 +144,7 @@ extern int area_height;
extern const uint8_t x5x7_bits []; extern const uint8_t x5x7_bits [];
extern const uint8_t numfont20x22[][22 * 3]; extern const uint8_t numfont20x22[][22 * 3];
#define S_DELTA "\004"
#define S_PI "\034" #define S_PI "\034"
#define S_MICRO "\035" #define S_MICRO "\035"
#define S_OHM "\036" #define S_OHM "\036"

22
plot.c
View file

@ -756,13 +756,13 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[101][2], int
case TRC_LOGMAG: case TRC_LOGMAG:
v = logmag(coeff) - logmag(coeff_ref); v = logmag(coeff) - logmag(coeff_ref);
if (v == -INFINITY) if (v == -INFINITY)
chsnprintf(buf, len, "\004-INF dB"); chsnprintf(buf, len, S_DELTA "-INF dB");
else else
chsnprintf(buf, len, "\004%.2fdB", v); chsnprintf(buf, len, S_DELTA "%.2fdB", v);
break; break;
case TRC_PHASE: case TRC_PHASE:
v = phase(coeff) - phase(coeff_ref); v = phase(coeff) - phase(coeff_ref);
chsnprintf(buf, len, "\004%.2f" S_DEGREE, v); chsnprintf(buf, len, S_DELTA "%.2f" S_DEGREE, v);
break; break;
case TRC_DELAY: case TRC_DELAY:
v = groupdelay_from_array(index, array) - groupdelay_from_array(index_ref, array); 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; break;
case TRC_LINEAR: case TRC_LINEAR:
v = linear(coeff) - linear(coeff_ref); v = linear(coeff) - linear(coeff_ref);
chsnprintf(buf, len, "\004%.2f", v); chsnprintf(buf, len, S_DELTA "%.2f", v);
break; break;
case TRC_SWR: case TRC_SWR:
v = swr(coeff) - swr(coeff_ref); v = swr(coeff) - swr(coeff_ref);
chsnprintf(buf, len, "\004%.2f", v); chsnprintf(buf, len, S_DELTA "%.2f", v);
break; break;
case TRC_SMITH: case TRC_SMITH:
format_smith_value(buf, len, coeff, frequencies[index]); format_smith_value(buf, len, coeff, frequencies[index]);
break; break;
case TRC_REAL: 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; break;
case TRC_IMAG: 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; break;
case TRC_R: case TRC_R:
gamma2resistance(buf, len, coeff); 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]; int32_t freq = frequencies[markers[mk].index];
if (uistat.marker_delta && mk != active_marker) { if (uistat.marker_delta && mk != active_marker) {
freq -= frequencies[markers[active_marker].index]; 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 { } else {
frequency_string_short(buf, sizeof buf, freq, 0); 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; int ypos = 1 + (j/2)*7;
xpos -= m * CELLWIDTH -CELLOFFSETX; xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT; 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); cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 19; xpos += 19;
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { 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; int ypos = 1 + (j/2)*7;
xpos -= m * CELLWIDTH -CELLOFFSETX; xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT; ypos -= n * CELLHEIGHT;
chsnprintf(buf, sizeof buf, "%d:", active_marker + 1); strcpy(buf, "1:");
buf[0] += active_marker;
xpos += 5; xpos += 5;
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, 0xffff, uistat.lever_mode == LM_MARKER); cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, 0xffff, uistat.lever_mode == LM_MARKER);
xpos += 14; xpos += 14;