feat: add marker operation groupdelay->edelay

This commit is contained in:
TT 2019-11-23 11:04:45 +09:00
parent 421c1be9f9
commit a3eb29ea04
3 changed files with 12 additions and 1 deletions

View file

@ -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
View file

@ -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
View file

@ -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
};