mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
feat: add marker operation groupdelay->edelay
This commit is contained in:
parent
421c1be9f9
commit
a3eb29ea04
|
|
@ -206,6 +206,7 @@ void draw_battery_status(void);
|
|||
|
||||
void set_electrical_delay(float picoseconds);
|
||||
float get_electrical_delay(void);
|
||||
float groupdelay_from_array(int i, float array[101][2]);
|
||||
|
||||
// marker
|
||||
|
||||
|
|
|
|||
2
plot.c
2
plot.c
|
|
@ -503,7 +503,7 @@ cartesian_scale(float re, float im, int *xp, int *yp, float scale)
|
|||
*yp = HEIGHT/2 - y;
|
||||
}
|
||||
|
||||
static float
|
||||
float
|
||||
groupdelay_from_array(int i, float array[101][2])
|
||||
{
|
||||
if (i == 0) {
|
||||
|
|
|
|||
10
ui.c
10
ui.c
|
|
@ -818,11 +818,13 @@ menu_marker_op_cb(int item)
|
|||
case 3: /* MARKERS->SPAN */
|
||||
{
|
||||
if (previous_marker == -1 || active_marker == previous_marker) {
|
||||
// if only 1 marker is active, keep center freq and make span the marker comes to the edge
|
||||
int32_t center = get_sweep_frequency(ST_CENTER);
|
||||
int32_t span = center - freq;
|
||||
if (span < 0) span = -span;
|
||||
set_sweep_frequency(ST_SPAN, span * 2);
|
||||
} else {
|
||||
// if 2 or more marker active, set start and stop freq to each marker
|
||||
int32_t freq2 = get_marker_frequency(previous_marker);
|
||||
if (freq2 < 0)
|
||||
return;
|
||||
|
|
@ -835,6 +837,13 @@ menu_marker_op_cb(int item)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 4: /* MARKERS->EDELAY */
|
||||
{
|
||||
float (*array)[2] = measured[trace[uistat.current_trace].channel];
|
||||
float v = groupdelay_from_array(markers[active_marker].index, array);
|
||||
set_electrical_delay(electrical_delay + (v / 1e-12));
|
||||
}
|
||||
break;
|
||||
}
|
||||
ui_mode_normal();
|
||||
draw_cal_status();
|
||||
|
|
@ -1052,6 +1061,7 @@ const menuitem_t menu_marker_ops[] = {
|
|||
{ MT_CALLBACK, S_RARROW"STOP", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, S_RARROW"CENTER", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, S_RARROW"SPAN", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, S_RARROW"EDELAY", menu_marker_op_cb },
|
||||
{ MT_CANCEL, S_LARROW" BACK", NULL },
|
||||
{ MT_NONE, NULL, NULL } // sentinel
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue