mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
feat: paramterize number of y-grid, revert to 8
This commit is contained in:
parent
c89cd36f19
commit
7d2708afce
8
main.c
8
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 }
|
||||
|
|
|
|||
17
nanovna.h
17
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
|
||||
|
|
|
|||
12
plot.c
12
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<w){
|
||||
int y = 10*GRIDY - floatToInt((get_trace_refpos(t) * GRIDY)) - y0 - REFERENCE_Y_OFFSET;
|
||||
int y = HEIGHT - floatToInt((get_trace_refpos(t) * GRIDY)) - y0 - REFERENCE_Y_OFFSET;
|
||||
if (y+REFERENCE_HEIGHT>=0 && y-REFERENCE_HEIGHT<h)
|
||||
draw_refpos(w, h, x, y, config.trace_color[t]);
|
||||
}
|
||||
|
|
@ -1632,8 +1632,8 @@ draw_frequencies(void)
|
|||
buf1[0] = S_SARROW[0];
|
||||
if (uistat.lever_mode == LM_SPAN)
|
||||
buf2[0] = S_SARROW[0];
|
||||
ili9341_drawstring(buf1, OFFSETX, 232);
|
||||
ili9341_drawstring(buf2, 200, 232);
|
||||
ili9341_drawstring(buf1, FREQUENCIES_XPOS1, FREQUENCIES_YPOS);
|
||||
ili9341_drawstring(buf2, FREQUENCIES_XPOS2, FREQUENCIES_YPOS);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in a new issue