mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2026-01-03 07:00:01 +01:00
Merge branch 'master' of git://github.com/ttrftech/NanoVNA
This commit is contained in:
commit
572b11444a
2
Makefile
2
Makefile
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
# Compiler options here.
|
||||
ifeq ($(USE_OPT),)
|
||||
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
|
||||
USE_OPT = -O2 -fno-inline-small-functions -ggdb -fomit-frame-pointer -falign-functions=16 --specs=nano.specs -fstack-usage
|
||||
endif
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
|
|
|
|||
1
main.c
1
main.c
|
|
@ -1329,6 +1329,7 @@ cal_interpolate(int s)
|
|||
}
|
||||
|
||||
cal_status |= src->_cal_status | CALSTAT_APPLY | CALSTAT_INTERPOLATED;
|
||||
redraw_request |= REDRAW_CAL_STATUS;
|
||||
}
|
||||
|
||||
static void cmd_cal(BaseSequentialStream *chp, int argc, char *argv[])
|
||||
|
|
|
|||
23
plot.c
23
plot.c
|
|
@ -1567,18 +1567,21 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
if ( (domain_mode & DOMAIN_MODE) == DOMAIN_FREQ )
|
||||
{
|
||||
frequency_string(buf, sizeof buf, frequencies[idx]);
|
||||
cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx));
|
||||
cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE);
|
||||
//chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx));
|
||||
int n = string_value_with_prefix(buf, sizeof buf, time_of_index(idx), 's');
|
||||
buf[n++] = ' ';
|
||||
string_value_with_prefix(&buf[n], sizeof buf-n, distance_of_index(idx), 'm');
|
||||
}
|
||||
cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE);
|
||||
|
||||
// draw marker delta
|
||||
if ( (previous_marker >= 0) && (active_marker != previous_marker) && (markers[previous_marker].enabled) )
|
||||
{
|
||||
int idx0 = markers[previous_marker].index;
|
||||
|
||||
xpos = 160;
|
||||
xpos -= m * CELLWIDTH - CELLOFFSETX;
|
||||
ypos += MARKER_Y_DELTA;
|
||||
|
|
@ -1587,8 +1590,20 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
strwidthpx = cell_drawstring_8x8(w, h, buf, xpos, ypos, 0xffff, FALSE);
|
||||
xpos += strwidthpx + 4;
|
||||
|
||||
frequency_string(buf, sizeof buf, frequencies[idx] - frequencies[idx0]);
|
||||
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ)
|
||||
{
|
||||
frequency_string(buf, sizeof buf, frequencies[idx] - frequencies[idx0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9 - time_of_index(idx0) * 1e9),
|
||||
// distance_of_index(idx) - distance_of_index(idx0));
|
||||
int n = string_value_with_prefix(buf, sizeof buf, time_of_index(idx) - time_of_index(idx0), 's');
|
||||
buf[n++] = ' ';
|
||||
string_value_with_prefix(&buf[n], sizeof buf - n, distance_of_index(idx) - distance_of_index(idx0), 'm');
|
||||
}
|
||||
cell_drawstring_8x8_var(w, h, buf, xpos, ypos, 0xffff, FALSE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ class NanoVNA:
|
|||
self.filter = None # bandpassfilter_5khz
|
||||
self._frequencies = None
|
||||
self.points = 101
|
||||
self.set_sweep(1e6, 900e6)
|
||||
|
||||
@property
|
||||
def frequencies(self):
|
||||
|
|
@ -228,10 +227,12 @@ class NanoVNA:
|
|||
|
||||
def logmag(self, x):
|
||||
pl.grid(True)
|
||||
pl.xlim(self.frequencies[0], self.frequencies[-1])
|
||||
pl.plot(self.frequencies, 20*np.log10(np.abs(x)))
|
||||
|
||||
def linmag(self, x):
|
||||
pl.grid(True)
|
||||
pl.xlim(self.frequencies[0], self.frequencies[-1])
|
||||
pl.plot(self.frequencies, np.abs(x))
|
||||
|
||||
def phase(self, x, unwrap=False):
|
||||
|
|
@ -241,21 +242,25 @@ class NanoVNA:
|
|||
a = np.unwrap(a)
|
||||
else:
|
||||
pl.ylim((-180,180))
|
||||
pl.xlim(self.frequencies[0], self.frequencies[-1])
|
||||
pl.plot(self.frequencies, np.rad2deg(a))
|
||||
|
||||
def delay(self, x):
|
||||
pl.grid(True)
|
||||
delay = -np.unwrap(np.angle(x))/ (2*np.pi*np.array(self.frequencies))
|
||||
pl.xlim(self.frequencies[0], self.frequencies[-1])
|
||||
pl.plot(self.frequencies, delay)
|
||||
|
||||
def groupdelay(self, x):
|
||||
pl.grid(True)
|
||||
gd = np.convolve(np.unwrap(np.angle(x)), [1,-1], mode='same')
|
||||
pl.xlim(self.frequencies[0], self.frequencies[-1])
|
||||
pl.plot(self.frequencies, gd)
|
||||
|
||||
def vswr(self, x):
|
||||
pl.grid(True)
|
||||
vswr = (1+np.abs(x))/(1-np.abs(x))
|
||||
pl.xlim(self.frequencies[0], self.frequencies[-1])
|
||||
pl.plot(self.frequencies, vswr)
|
||||
|
||||
def polar(self, x):
|
||||
|
|
@ -426,7 +431,9 @@ if __name__ == '__main__':
|
|||
else:
|
||||
if opt.start or opt.stop:
|
||||
nv.set_sweep(opt.start, opt.stop)
|
||||
nv.fetch_frequencies()
|
||||
s = nv.data(p)
|
||||
nv.fetch_frequencies()
|
||||
if opt.smith:
|
||||
nv.smith(s)
|
||||
if opt.polar:
|
||||
|
|
|
|||
Loading…
Reference in a new issue