feat: show second marker position on time domain (fixed #85)

This commit is contained in:
TT 2019-10-18 00:46:12 +09:00
parent 87c6e64a25
commit 65a07a7a27

21
plot.c
View file

@ -1445,15 +1445,18 @@ cell_draw_marker_info(int m, int n, int w, int h)
xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT;
chsnprintf(buf, sizeof buf, "%d:", active_marker + 1);
xpos += 5;
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 16;
xpos += 14;
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
frequency_string(buf, sizeof buf, frequencies[idx]);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
} else {
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);
//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_5x7(w, h, buf, xpos, ypos, 0xffff);
// draw marker delta
if (previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled) {
@ -1463,8 +1466,16 @@ cell_draw_marker_info(int m, int n, int w, int h)
ypos += 7;
chsnprintf(buf, sizeof buf, "\001%d:", previous_marker+1);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
xpos += 16;
xpos += 19;
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_5x7(w, h, buf, xpos, ypos, 0xffff);
}
}