feat: show each markers when multiple markers are active

This commit is contained in:
TT 2019-11-23 17:47:14 +09:00
parent a3eb29ea04
commit 1422e5fd49
3 changed files with 49 additions and 21 deletions

View file

@ -210,6 +210,8 @@ float groupdelay_from_array(int i, float array[101][2]);
// marker // marker
#define MARKERS_MAX 4
typedef struct { typedef struct {
int8_t enabled; int8_t enabled;
int16_t index; int16_t index;
@ -300,7 +302,7 @@ typedef struct {
float _electrical_delay; // picoseconds float _electrical_delay; // picoseconds
trace_t _trace[TRACES_MAX]; trace_t _trace[TRACES_MAX];
marker_t _markers[4]; marker_t _markers[MARKERS_MAX];
int _active_marker; int _active_marker;
uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */ uint8_t _domain_mode; /* 0bxxxxxffm : where ff: TD_FUNC m: DOMAIN_MODE */
uint8_t _velocity_factor; // % uint8_t _velocity_factor; // %

30
plot.c
View file

@ -1191,7 +1191,7 @@ cell_draw_markers(int m, int n, int w, int h)
int x0 = m * CELLWIDTH; int x0 = m * CELLWIDTH;
int y0 = n * CELLHEIGHT; int y0 = n * CELLHEIGHT;
int t, i; int t, i;
for (i = 0; i < 4; i++) { for (i = 0; i < MARKERS_MAX; i++) {
if (!markers[i].enabled) if (!markers[i].enabled)
continue; continue;
for (t = 0; t < TRACES_MAX; t++) { for (t = 0; t < TRACES_MAX; t++) {
@ -1239,7 +1239,7 @@ void
markmap_all_markers(void) markmap_all_markers(void)
{ {
int i; int i;
for (i = 0; i < 4; i++) { for (i = 0; i < MARKERS_MAX; i++) {
if (!markers[i].enabled) if (!markers[i].enabled)
continue; continue;
markmap_marker(i); markmap_marker(i);
@ -1493,6 +1493,28 @@ cell_draw_marker_info(int m, int n, int w, int h)
return; return;
int idx = markers[active_marker].index; int idx = markers[active_marker].index;
int j = 0; int j = 0;
if (active_marker != -1 && previous_marker != -1 && uistat.current_trace != -1) {
int t = uistat.current_trace;
int mk;
for (mk = 0; mk < MARKERS_MAX; mk++) {
if (!markers[mk].enabled)
continue;
int xpos = 1 + (j%2)*146;
int ypos = 1 + (j/2)*7;
xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT;
strcpy(buf, "MK1");
buf[2] += mk;
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], mk == active_marker);
xpos += 20;
trace_get_info(t, buf, sizeof buf);
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
xpos += 64;
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], markers[mk].index);
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
j++;
}
} else {
for (t = 0; t < TRACES_MAX; t++) { for (t = 0; t < TRACES_MAX; t++) {
if (!trace[t].enabled) if (!trace[t].enabled)
continue; continue;
@ -1500,6 +1522,8 @@ cell_draw_marker_info(int m, int n, int w, int h)
int ypos = 1 + (j/2)*7; int ypos = 1 + (j/2)*7;
xpos -= m * CELLWIDTH -CELLOFFSETX; xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT; ypos -= n * CELLHEIGHT;
strcpy(buf, "CH0");
buf[2] += t;
chsnprintf(buf, sizeof buf, "CH%d", trace[t].channel); chsnprintf(buf, sizeof buf, "CH%d", trace[t].channel);
cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace); cell_drawstring_invert_5x7(w, h, buf, xpos, ypos, config.trace_color[t], t == uistat.current_trace);
xpos += 20; xpos += 20;
@ -1510,7 +1534,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]); cell_drawstring_5x7(w, h, buf, xpos, ypos, config.trace_color[t]);
j++; j++;
} }
}
if (electrical_delay != 0) { if (electrical_delay != 0) {
// draw electrical delay // draw electrical delay
int xpos = 21; int xpos = 21;

2
ui.c
View file

@ -839,6 +839,8 @@ menu_marker_op_cb(int item)
break; break;
case 4: /* MARKERS->EDELAY */ case 4: /* MARKERS->EDELAY */
{ {
if (uistat.current_trace == -1)
break;
float (*array)[2] = measured[trace[uistat.current_trace].channel]; float (*array)[2] = measured[trace[uistat.current_trace].channel];
float v = groupdelay_from_array(markers[active_marker].index, array); float v = groupdelay_from_array(markers[active_marker].index, array);
set_electrical_delay(electrical_delay + (v / 1e-12)); set_electrical_delay(electrical_delay + (v / 1e-12));