view: pack smith marker value

This commit is contained in:
TT 2020-02-01 00:13:53 +09:00
parent dd4074d501
commit ae38c9794d
2 changed files with 24 additions and 25 deletions

View file

@ -249,7 +249,6 @@ void redraw_frame(void);
void request_to_draw_cells_behind_menu(void); void request_to_draw_cells_behind_menu(void);
void request_to_draw_cells_behind_numeric_input(void); void request_to_draw_cells_behind_numeric_input(void);
void redraw_marker(int marker, int update_info); void redraw_marker(int marker, int update_info);
void trace_get_info(int t, char *buf, int len);
void plot_into_index(float measured[2][POINTS_COUNT][2]); void plot_into_index(float measured[2][POINTS_COUNT][2]);
void force_set_markmap(void); void force_set_markmap(void);
void draw_frequencies(void); void draw_frequencies(void);
@ -289,20 +288,13 @@ extern int16_t vbat;
#define DEFAULT_MENU_COLOR RGB565(255,255,255) #define DEFAULT_MENU_COLOR RGB565(255,255,255)
#define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0) #define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0)
#define DEFAULT_MENU_ACTIVE_COLOR RGB565(180,255,180) #define DEFAULT_MENU_ACTIVE_COLOR RGB565(180,255,180)
<<<<<<< HEAD
#define DEFAULT_TRACE_1_COLOR RGB565(255,200, 14)
#define DEFAULT_TRACE_2_COLOR RGB565( 0,191,231)
#define DEFAULT_TRACE_3_COLOR RGB565( 64,255, 0)
#define DEFAULT_TRACE_4_COLOR RGB565(255,160,100)
#define DEFAULT_NORMAL_BAT_COLOR RGB565( 31,227, 0)
#define DEFAULT_LOW_BAT_COLOR RGB565(255, 0, 0)
#define DEFAULT_SPEC_INPUT_COLOR RGB565(128,255,128);
=======
#define DEFAULT_TRACE_1_COLOR RGB565(255,255, 0) #define DEFAULT_TRACE_1_COLOR RGB565(255,255, 0)
#define DEFAULT_TRACE_2_COLOR RGB565( 0,255,255) #define DEFAULT_TRACE_2_COLOR RGB565( 0,255,255)
#define DEFAULT_TRACE_3_COLOR RGB565( 0,255, 0) #define DEFAULT_TRACE_3_COLOR RGB565( 0,255, 0)
#define DEFAULT_TRACE_4_COLOR RGB565(255, 0,255) #define DEFAULT_TRACE_4_COLOR RGB565(255, 0,255)
>>>>>>> fix: revert color of traces to the original #define DEFAULT_NORMAL_BAT_COLOR RGB565( 31,227, 0)
#define DEFAULT_LOW_BAT_COLOR RGB565(255, 0, 0)
#define DEFAULT_SPEC_INPUT_COLOR RGB565(128,255,128);
extern uint16_t foreground_color; extern uint16_t foreground_color;
extern uint16_t background_color; extern uint16_t background_color;

35
plot.c
View file

@ -791,28 +791,32 @@ trace_get_value_string_delta(int t, char *buf, int len, float array[POINTS_COUNT
} }
} }
void static int
trace_get_info(int t, char *buf, int len) trace_get_info(int t, char *buf, int len)
{ {
const char *type = get_trace_typename(t); strcpy(buf, get_trace_typename(t));
int n; int n = strlen(buf);
char *p = buf + n;
len -= n;
switch (trace[t].type) { switch (trace[t].type) {
case TRC_LOGMAG: case TRC_LOGMAG:
chsnprintf(buf, len, "%s %ddB/", type, (int)get_trace_scale(t)); n += chsnprintf(p, len, " %ddB/", (int)get_trace_scale(t));
break; break;
case TRC_PHASE: case TRC_PHASE:
chsnprintf(buf, len, "%s %d" S_DEGREE "/", type, (int)get_trace_scale(t)); n += chsnprintf(p, len, " %d" S_DEGREE "/", (int)get_trace_scale(t));
break; break;
case TRC_SMITH: case TRC_SMITH:
//case TRC_ADMIT: //case TRC_ADMIT:
case TRC_POLAR: case TRC_POLAR:
chsnprintf(buf, len, "%s %.1fFS", type, get_trace_scale(t)); if (get_trace_scale(t) != 1.0)
n += chsnprintf(p, len, " %.1fFS", get_trace_scale(t));
break; break;
default: default:
n = chsnprintf(buf, len, "%s ", type); strcat(p, " ");
string_value_with_prefix(buf+n, len-n, get_trace_scale(t), '/'); string_value_with_prefix(p+1, len-1 , get_trace_scale(t), '/');
break; break;
} }
return n;
} }
static float time_of_index(int idx) { static float time_of_index(int idx) {
@ -1677,14 +1681,14 @@ cell_draw_marker_info(int m, int n, int w, int h)
int ypos = 1 + (j/2)*8; int ypos = 1 + (j/2)*8;
xpos -= m * CELLWIDTH -CELLOFFSETX; xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT; ypos -= n * CELLHEIGHT;
strcpy(buf, S_DELTA "1:"); strcpy(buf, S_DELTA "1-1:");
buf[1] += previous_marker; buf[1] += active_marker;
buf[3] += previous_marker;
setForegroundColor(DEFAULT_FG_COLOR); setForegroundColor(DEFAULT_FG_COLOR);
cell_drawstring(w, h, buf, xpos, ypos); cell_drawstring(w, h, buf, xpos, ypos);
xpos += 19; xpos += 29;
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
uint32_t delta = frequencies[idx] > frequencies[idx0] ? frequencies[idx]-frequencies[idx0] : frequencies[idx0]-frequencies[idx]; frequency_string_short(buf, sizeof buf, frequencies[idx] - frequencies[idx0], 0);
frequency_string(buf, sizeof buf, delta, "");
} else { } else {
//chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9 - time_of_index(idx0) * 1e9), //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)); // distance_of_index(idx) - distance_of_index(idx0));
@ -1718,8 +1722,10 @@ cell_draw_marker_info(int m, int n, int w, int h)
trace_get_info(t, buf, sizeof buf); trace_get_info(t, buf, sizeof buf);
cell_drawstring(w, h, buf, xpos, ypos); cell_drawstring(w, h, buf, xpos, ypos);
xpos += 60; xpos += (strlen(buf) + 1) * 5;
//xpos += 60;
trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], idx); trace_get_value_string(t, buf, sizeof buf, measured[trace[t].channel], idx);
setForegroundColor(DEFAULT_FG_COLOR);
cell_drawstring(w, h, buf, xpos, ypos); cell_drawstring(w, h, buf, xpos, ypos);
j++; j++;
} }
@ -1736,6 +1742,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
// setForegroundColor(0xffff); // setForegroundColor(0xffff);
// cell_drawstring_invert(w, h, buf, xpos, ypos, uistat.lever_mode == LM_MARKER); // cell_drawstring_invert(w, h, buf, xpos, ypos, uistat.lever_mode == LM_MARKER);
// xpos += 14; // xpos += 14;
setForegroundColor(DEFAULT_FG_COLOR);
if (uistat.lever_mode == LM_MARKER) if (uistat.lever_mode == LM_MARKER)
cell_drawstring(w, h, S_SARROW, xpos, ypos); cell_drawstring(w, h, S_SARROW, xpos, ypos);
xpos += 5; xpos += 5;