mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Fix interpolation range if sweep_points!=source calibration points count
use sweep_points exept POINTS_COUNT on marker search and so Now possible change sweep_points in process (for faster sweep)
This commit is contained in:
parent
fdb3886b0f
commit
3eb8a4cfe9
8
main.c
8
main.c
|
|
@ -856,7 +856,7 @@ VNA_SHELL_FUNCTION(cmd_scan)
|
||||||
}
|
}
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
points = my_atoi(argv[2]);
|
points = my_atoi(argv[2]);
|
||||||
if (points <= 0 || points > sweep_points) {
|
if (points <= 0 || points > POINTS_COUNT) {
|
||||||
shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n");
|
shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -929,7 +929,7 @@ set_frequencies(uint32_t start, uint32_t stop, uint16_t points)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// disable at out of sweep range
|
// disable at out of sweep range
|
||||||
for (; i < sweep_points; i++)
|
for (; i < POINTS_COUNT; i++)
|
||||||
frequencies[i] = 0;
|
frequencies[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1360,7 +1360,7 @@ cal_interpolate(int s)
|
||||||
for (; i < sweep_points; i++) {
|
for (; i < sweep_points; i++) {
|
||||||
uint32_t f = frequencies[i];
|
uint32_t f = frequencies[i];
|
||||||
|
|
||||||
for (; j < sweep_points-1; j++) {
|
for (; j < src->_sweep_points-1; j++) {
|
||||||
if (src->_frequencies[j] <= f && f < src->_frequencies[j+1]) {
|
if (src->_frequencies[j] <= f && f < src->_frequencies[j+1]) {
|
||||||
// found f between freqs at j and j+1
|
// found f between freqs at j and j+1
|
||||||
float k1 = (float)(f - src->_frequencies[j])
|
float k1 = (float)(f - src->_frequencies[j])
|
||||||
|
|
@ -1380,7 +1380,7 @@ cal_interpolate(int s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j == sweep_points-1)
|
if (j == src->_sweep_points-1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
plot.c
10
plot.c
|
|
@ -499,7 +499,7 @@ float
|
||||||
groupdelay_from_array(int i, float array[POINTS_COUNT][2])
|
groupdelay_from_array(int i, float array[POINTS_COUNT][2])
|
||||||
{
|
{
|
||||||
int bottom = (i == 0) ? 0 : i - 1;
|
int bottom = (i == 0) ? 0 : i - 1;
|
||||||
int top = (i == POINTS_COUNT-1) ? POINTS_COUNT-1 : i + 1;
|
int top = (i == sweep_points-1) ? sweep_points-1 : i + 1;
|
||||||
float deltaf = frequencies[top] - frequencies[bottom];
|
float deltaf = frequencies[top] - frequencies[bottom];
|
||||||
return groupdelay(array[bottom], array[top], deltaf);
|
return groupdelay(array[bottom], array[top], deltaf);
|
||||||
}
|
}
|
||||||
|
|
@ -1062,7 +1062,7 @@ marker_search(void)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int value = CELL_Y(trace_index[uistat.current_trace][0]);
|
int value = CELL_Y(trace_index[uistat.current_trace][0]);
|
||||||
for (i = 0; i < POINTS_COUNT; i++) {
|
for (i = 0; i < sweep_points; i++) {
|
||||||
index_t index = trace_index[uistat.current_trace][i];
|
index_t index = trace_index[uistat.current_trace][i];
|
||||||
if ((*compare)(value, CELL_Y(index))) {
|
if ((*compare)(value, CELL_Y(index))) {
|
||||||
value = CELL_Y(index);
|
value = CELL_Y(index);
|
||||||
|
|
@ -1117,14 +1117,14 @@ marker_search_right(int from)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int value = CELL_Y(trace_index[uistat.current_trace][from]);
|
int value = CELL_Y(trace_index[uistat.current_trace][from]);
|
||||||
for (i = from + 1; i < POINTS_COUNT; i++) {
|
for (i = from + 1; i < sweep_points; i++) {
|
||||||
index_t index = trace_index[uistat.current_trace][i];
|
index_t index = trace_index[uistat.current_trace][i];
|
||||||
if ((*compare)(value, CELL_Y(index)))
|
if ((*compare)(value, CELL_Y(index)))
|
||||||
break;
|
break;
|
||||||
value = CELL_Y(index);
|
value = CELL_Y(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < POINTS_COUNT; i++) {
|
for (; i < sweep_points; i++) {
|
||||||
index_t index = trace_index[uistat.current_trace][i];
|
index_t index = trace_index[uistat.current_trace][i];
|
||||||
if ((*compare)(CELL_Y(index), value)) {
|
if ((*compare)(CELL_Y(index), value)) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1603,7 +1603,7 @@ draw_frequencies(void)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
plot_printf(buf1, sizeof(buf1), " START 0s");
|
plot_printf(buf1, sizeof(buf1), " START 0s");
|
||||||
plot_printf(buf2, sizeof(buf2), "STOP %Fs (%Fm)", time_of_index(POINTS_COUNT-1), distance_of_index(POINTS_COUNT-1));
|
plot_printf(buf2, sizeof(buf2), "STOP %Fs (%Fm)", time_of_index(sweep_points-1), distance_of_index(sweep_points-1));
|
||||||
}
|
}
|
||||||
setForegroundColor(DEFAULT_FG_COLOR);
|
setForegroundColor(DEFAULT_FG_COLOR);
|
||||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||||
|
|
|
||||||
2
ui.c
2
ui.c
|
|
@ -1641,7 +1641,7 @@ lever_move_marker(int status)
|
||||||
markers[active_marker].frequency = frequencies[markers[active_marker].index];
|
markers[active_marker].frequency = frequencies[markers[active_marker].index];
|
||||||
redraw_marker(active_marker);
|
redraw_marker(active_marker);
|
||||||
}
|
}
|
||||||
if ((status & EVT_UP) && markers[active_marker].index < 100) {
|
if ((status & EVT_UP) && markers[active_marker].index < sweep_points-1) {
|
||||||
markers[active_marker].index++;
|
markers[active_marker].index++;
|
||||||
markers[active_marker].frequency = frequencies[markers[active_marker].index];
|
markers[active_marker].frequency = frequencies[markers[active_marker].index];
|
||||||
redraw_marker(active_marker);
|
redraw_marker(active_marker);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue