minor fixes

This commit is contained in:
cho45 2019-09-11 08:17:40 +09:00
parent 8f0bfacf3d
commit b17ecfa533
2 changed files with 13 additions and 9 deletions

10
plot.c
View file

@ -701,6 +701,12 @@ trace_get_info(int t, char *buf, int len)
}
}
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)
{
@ -1371,9 +1377,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 {
#define SPEED_OF_LIGHT 299792458
float distance = ((float)idx * (float)SPEED_OF_LIGHT) / ( (float)(frequencies[1] - frequencies[0]) * 128.0 * 2.0);
chsnprintf(buf, sizeof buf, "%.1f m (%d%%)", distance * (velocity_factor / 100.0), velocity_factor);
chsnprintf(buf, sizeof buf, "%.1f m (VF=%d%%)", distance_of_index(idx), velocity_factor);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
}