diff --git a/main.c b/main.c index af766084..c34d85c8 100644 --- a/main.c +++ b/main.c @@ -706,10 +706,10 @@ properties_t current_props = { ._frequency1 = 900000000, // end = 900MHz ._sweep_points = POINTS_COUNT, ._trace = {/*enable, type, channel, reserved, scale, refpos*/ - { 1, TRC_LOGMAG, 0, 0, 10.0, 9.0 }, - { 1, TRC_LOGMAG, 1, 0, 10.0, 9.0 }, - { 1, TRC_SMITH, 0, 0, 1.0, 0.0 }, - { 1, TRC_PHASE, 1, 0, 90.0, 5.0 } + { 1, TRC_LOGMAG, 0, 0, 10.0, NGRIDY-1 }, + { 1, TRC_LOGMAG, 1, 0, 10.0, NGRIDY-1 }, + { 1, TRC_SMITH, 0, 0, 1.0, 0 }, + { 1, TRC_PHASE, 1, 0, 90.0, NGRIDY/2 } }, ._markers = { { 1, 30, 0 }, { 0, 40, 0 }, { 0, 60, 0 }, { 0, 80, 0 } diff --git a/nanovna.h b/nanovna.h index a19d6fac..f0a903d4 100644 --- a/nanovna.h +++ b/nanovna.h @@ -129,8 +129,6 @@ extern void tlv320aic3204_select(int channel); /* * plot.c */ -// GRIDX calculated depends from frequency span -#define GRIDY 23 // Offset of plot area #define OFFSETX 10 @@ -138,8 +136,19 @@ extern void tlv320aic3204_select(int channel); // WIDTH better be n*(POINTS_COUNT-1) #define WIDTH 300 -// HEIGHT = 10*GRIDY -#define HEIGHT 230 +// HEIGHT = 8*GRIDY +#define HEIGHT 232 + +//#define NGRIDY 10 +#define NGRIDY 8 + +#define FREQUENCIES_XPOS1 OFFSETX +#define FREQUENCIES_XPOS2 200 +#define FREQUENCIES_YPOS (HEIGHT+1) + +// GRIDX calculated depends from frequency span +//#define GRIDY 29 +#define GRIDY (HEIGHT / NGRIDY) // #define CELLOFFSETX 5 diff --git a/plot.c b/plot.c index eb3de6df..3c48dd45 100644 --- a/plot.c +++ b/plot.c @@ -508,7 +508,7 @@ trace_into_index(int t, int i, float array[POINTS_COUNT][2]) int y, x; float *coeff = array[i]; - float refpos = 10 - get_trace_refpos(t); + float refpos = NGRIDY - get_trace_refpos(t); float v = refpos; float scale = 1 / get_trace_scale(t); switch (trace[t].type) { @@ -545,8 +545,8 @@ trace_into_index(int t, int i, float array[POINTS_COUNT][2]) cartesian_scale(coeff[0], coeff[1], &x, &y, scale); goto set_index; } - if (v < 0) v = 0; - if (v > 10) v = 10; + if (v < 0) v = 0; + if (v > NGRIDY) v = NGRIDY; x = (i * (WIDTH) + (sweep_points-1)/2) / (sweep_points-1) + CELLOFFSETX; y = floatToInt(v * GRIDY); set_index: @@ -1367,7 +1367,7 @@ draw_cell(int m, int n) continue; int x = 0 - x0 + CELLOFFSETX - REFERENCE_X_OFFSET; if (x+REFERENCE_WIDTH>=0 && x-REFERENCE_WIDTH=0 && y-REFERENCE_HEIGHT