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
17
plot.c
17
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) {
|
static float distance_of_index(int idx) {
|
||||||
#define SPEED_OF_LIGHT 299792458
|
#define SPEED_OF_LIGHT 299792458
|
||||||
float distance = ((float)idx * (float)SPEED_OF_LIGHT) / ( (float)(frequencies[1] - frequencies[0]) * 128.0 * 2.0);
|
float distance = ((float)idx * (float)SPEED_OF_LIGHT) / ( (float)(frequencies[1] - frequencies[0]) * 128.0 * 2.0);
|
||||||
return distance * (velocity_factor / 100.0);
|
return distance * (velocity_factor / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
mark_map(int x, int y)
|
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]);
|
frequency_string(buf, sizeof buf, frequencies[idx]);
|
||||||
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
|
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
|
||||||
} else {
|
} 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);
|
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1421,6 +1426,7 @@ void
|
||||||
draw_frequencies(void)
|
draw_frequencies(void)
|
||||||
{
|
{
|
||||||
char buf[24];
|
char buf[24];
|
||||||
|
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
|
||||||
if (frequency1 > 0) {
|
if (frequency1 > 0) {
|
||||||
int start = frequency0;
|
int start = frequency0;
|
||||||
int stop = frequency1;
|
int stop = frequency1;
|
||||||
|
|
@ -1453,6 +1459,15 @@ draw_frequencies(void)
|
||||||
chsnprintf(buf, 24, " ");
|
chsnprintf(buf, 24, " ");
|
||||||
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue