mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
feat: show each markers when multiple markers are active
This commit is contained in:
parent
a3eb29ea04
commit
1422e5fd49
|
|
@ -210,6 +210,8 @@ float groupdelay_from_array(int i, float array[101][2]);
|
||||||
|
|
||||||
// marker
|
// marker
|
||||||
|
|
||||||
|
#define MARKERS_MAX 4
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t enabled;
|
int8_t enabled;
|
||||||
int16_t index;
|
int16_t index;
|
||||||
|
|
@ -300,7 +302,7 @@ typedef struct {
|
||||||
float _electrical_delay; // picoseconds
|
float _electrical_delay; // picoseconds
|
||||||
|
|
||||||
trace_t _trace[TRACES_MAX];
|
trace_t _trace[TRACES_MAX];
|
||||||
marker_t _markers[4];
|
marker_t _markers[MARKERS_MAX];
|
||||||
int _active_marker;
|
int _active_marker;
|
||||||
uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */
|
uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */
|
||||||
uint8_t _velocity_factor; // %
|
uint8_t _velocity_factor; // %
|
||||||
|
|
|
||||||
64
plot.c
64
plot.c
|
|
@ -1191,7 +1191,7 @@ cell_draw_markers(int m, int n, int w, int h)
|
||||||
int x0 = m * CELLWIDTH;
|
int x0 = m * CELLWIDTH;
|
||||||
int y0 = n * CELLHEIGHT;
|
int y0 = n * CELLHEIGHT;
|
||||||
int t, i;
|
int t, i;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < MARKERS_MAX; i++) {
|
||||||
if (!markers[i].enabled)
|
if (!markers[i].enabled)
|
||||||
continue;
|
continue;
|
||||||
for (t = 0; t < TRACES_MAX; t++) {
|
for (t = 0; t < TRACES_MAX; t++) {
|
||||||
|
|
@ -1239,7 +1239,7 @@ void
|
||||||
markmap_all_markers(void)
|
markmap_all_markers(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < MARKERS_MAX; i++) {
|
||||||
if (!markers[i].enabled)
|
if (!markers[i].enabled)
|
||||||
continue;
|
continue;
|
||||||
markmap_marker(i);
|
markmap_marker(i);
|
||||||
|
|
@ -1493,24 +1493,48 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
||||||
return;
|
return;
|
||||||
int idx = markers[active_marker].index;
|
int idx = markers[active_marker].index;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (t = 0; t < TRACES_MAX; t++) {
|
if (active_marker != -1 && previous_marker != -1 && uistat.current_trace != -1) {
|
||||||
if (!trace[t].enabled)
|
int t = uistat.current_trace;
|
||||||
continue;
|
int mk;
|
||||||
int xpos = 1 + (j%2)*146;
|
for (mk = 0; mk < MARKERS_MAX; mk++) {
|
||||||
int ypos = 1 + (j/2)*7;
|
if (!markers[mk].enabled)
|
||||||
xpos -= m * CELLWIDTH -CELLOFFSETX;
|
continue;
|
||||||
ypos -= n * CELLHEIGHT;
|
int xpos = 1 + (j%2)*146;
|
||||||
chsnprintf(buf, sizeof buf, "CH%d", trace[t].channel);
|
int ypos = 1 + (j/2)*7;
|
||||||
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace);
|
xpos -= m * CELLWIDTH -CELLOFFSETX;
|
||||||
xpos += 20;
|
ypos -= n * CELLHEIGHT;
|
||||||
trace_get_info(t, buf, sizeof buf);
|
strcpy(buf, "MK1");
|
||||||
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
|
buf[2] += mk;
|
||||||
xpos += 64;
|
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], mk == active_marker);
|
||||||
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], idx);
|
xpos += 20;
|
||||||
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
|
trace_get_info(t, buf, sizeof buf);
|
||||||
j++;
|
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
|
||||||
}
|
xpos += 64;
|
||||||
|
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], markers[mk].index);
|
||||||
|
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (t = 0; t < TRACES_MAX; t++) {
|
||||||
|
if (!trace[t].enabled)
|
||||||
|
continue;
|
||||||
|
int xpos = 1 + (j%2)*146;
|
||||||
|
int ypos = 1 + (j/2)*7;
|
||||||
|
xpos -= m * CELLWIDTH -CELLOFFSETX;
|
||||||
|
ypos -= n * CELLHEIGHT;
|
||||||
|
strcpy(buf, "CH0");
|
||||||
|
buf[2] += t;
|
||||||
|
chsnprintf(buf, sizeof buf, "CH%d", trace[t].channel);
|
||||||
|
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace);
|
||||||
|
xpos += 20;
|
||||||
|
trace_get_info(t, buf, sizeof buf);
|
||||||
|
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
|
||||||
|
xpos += 64;
|
||||||
|
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], idx);
|
||||||
|
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (electrical_delay != 0) {
|
if (electrical_delay != 0) {
|
||||||
// draw electrical delay
|
// draw electrical delay
|
||||||
int xpos = 21;
|
int xpos = 21;
|
||||||
|
|
|
||||||
2
ui.c
2
ui.c
|
|
@ -839,6 +839,8 @@ menu_marker_op_cb(int item)
|
||||||
break;
|
break;
|
||||||
case 4: /* MARKERS->EDELAY */
|
case 4: /* MARKERS->EDELAY */
|
||||||
{
|
{
|
||||||
|
if (uistat.current_trace == -1)
|
||||||
|
break;
|
||||||
float (*array)[2] = measured[trace[uistat.current_trace].channel];
|
float (*array)[2] = measured[trace[uistat.current_trace].channel];
|
||||||
float v = groupdelay_from_array(markers[active_marker].index, array);
|
float v = groupdelay_from_array(markers[active_marker].index, array);
|
||||||
set_electrical_delay(electrical_delay + (v / 1e-12));
|
set_electrical_delay(electrical_delay + (v / 1e-12));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue