mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
show time domain range
This commit is contained in:
parent
6bad9de606
commit
a3b511f468
77
plot.c
77
plot.c
|
|
@ -701,12 +701,17 @@ trace_get_info(int t, char *buf, int len)
|
|||
}
|
||||
}
|
||||
|
||||
static float time_of_index(int idx) {
|
||||
return 1.0 / (float)(frequencies[1] - frequencies[0]) / 128.0 * idx;
|
||||
}
|
||||
|
||||
static float distance_of_index(int idx) {
|
||||
#define SPEED_OF_LIGHT 299792458
|
||||
float distance = ((float)idx * (float)SPEED_OF_LIGHT) / ( (float)(frequencies[1] - frequencies[0]) * 128.0 * 2.0);
|
||||
return distance * (velocity_factor / 100.0);
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
mark_map(int x, int y)
|
||||
{
|
||||
|
|
@ -1377,7 +1382,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
frequency_string(buf, sizeof buf, frequencies[idx]);
|
||||
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
|
||||
} else {
|
||||
chsnprintf(buf, sizeof buf, "%.1f m (VF=%d%%)", distance_of_index(idx), velocity_factor);
|
||||
chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9), distance_of_index(idx));
|
||||
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
|
||||
}
|
||||
|
||||
|
|
@ -1421,37 +1426,47 @@ void
|
|||
draw_frequencies(void)
|
||||
{
|
||||
char buf[24];
|
||||
if (frequency1 > 0) {
|
||||
int start = frequency0;
|
||||
int stop = frequency1;
|
||||
strcpy(buf, "START ");
|
||||
frequency_string(buf+6, 24-6, start);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
strcpy(buf, "STOP ");
|
||||
frequency_string(buf+5, 24-5, stop);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
} else if (frequency1 < 0) {
|
||||
int fcenter = frequency0;
|
||||
int fspan = -frequency1;
|
||||
strcpy(buf, "CENTER ");
|
||||
frequency_string(buf+7, 24-7, fcenter);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
strcpy(buf, "SPAN ");
|
||||
frequency_string(buf+5, 24-5, fspan);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
|
||||
if (frequency1 > 0) {
|
||||
int start = frequency0;
|
||||
int stop = frequency1;
|
||||
strcpy(buf, "START ");
|
||||
frequency_string(buf+6, 24-6, start);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
strcpy(buf, "STOP ");
|
||||
frequency_string(buf+5, 24-5, stop);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
} else if (frequency1 < 0) {
|
||||
int fcenter = frequency0;
|
||||
int fspan = -frequency1;
|
||||
strcpy(buf, "CENTER ");
|
||||
frequency_string(buf+7, 24-7, fcenter);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
strcpy(buf, "SPAN ");
|
||||
frequency_string(buf+5, 24-5, fspan);
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
} else {
|
||||
int fcenter = frequency0;
|
||||
chsnprintf(buf, 24, "CW %d.%03d %03d MHz ",
|
||||
(int)(fcenter / 1000000),
|
||||
(int)((fcenter / 1000) % 1000),
|
||||
(int)(fcenter % 1000));
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
chsnprintf(buf, 24, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
}
|
||||
} else {
|
||||
int fcenter = frequency0;
|
||||
chsnprintf(buf, 24, "CW %d.%03d %03d MHz ",
|
||||
(int)(fcenter / 1000000),
|
||||
(int)((fcenter / 1000) % 1000),
|
||||
(int)(fcenter % 1000));
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
chsnprintf(buf, 24, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
strcpy(buf, "START 0s ");
|
||||
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
|
||||
|
||||
strcpy(buf, "STOP ");
|
||||
chsnprintf(buf+5, 24-5, "%d ns", (uint16_t)(time_of_index(101) * 1e9));
|
||||
strcat(buf, " ");
|
||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue