diff --git a/nanovna.h b/nanovna.h index 3c81479..800b4e1 100644 --- a/nanovna.h +++ b/nanovna.h @@ -249,7 +249,6 @@ void redraw_frame(void); void request_to_draw_cells_behind_menu(void); void request_to_draw_cells_behind_numeric_input(void); 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 force_set_markmap(void); void draw_frequencies(void); @@ -289,20 +288,13 @@ extern int16_t vbat; #define DEFAULT_MENU_COLOR RGB565(255,255,255) #define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0) #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_2_COLOR RGB565( 0,255,255) #define DEFAULT_TRACE_3_COLOR RGB565( 0,255, 0) #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 background_color; diff --git a/plot.c b/plot.c index 0b069b7..14e992e 100644 --- a/plot.c +++ b/plot.c @@ -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) { - const char *type = get_trace_typename(t); - int n; + strcpy(buf, get_trace_typename(t)); + int n = strlen(buf); + char *p = buf + n; + len -= n; switch (trace[t].type) { 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; 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; case TRC_SMITH: //case TRC_ADMIT: 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; default: - n = chsnprintf(buf, len, "%s ", type); - string_value_with_prefix(buf+n, len-n, get_trace_scale(t), '/'); + strcat(p, " "); + string_value_with_prefix(p+1, len-1 , get_trace_scale(t), '/'); break; } + return n; } 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; xpos -= m * CELLWIDTH -CELLOFFSETX; ypos -= n * CELLHEIGHT; - strcpy(buf, S_DELTA "1:"); - buf[1] += previous_marker; + strcpy(buf, S_DELTA "1-1:"); + buf[1] += active_marker; + buf[3] += previous_marker; setForegroundColor(DEFAULT_FG_COLOR); cell_drawstring(w, h, buf, xpos, ypos); - xpos += 19; + xpos += 29; if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) { - uint32_t delta = frequencies[idx] > frequencies[idx0] ? frequencies[idx]-frequencies[idx0] : frequencies[idx0]-frequencies[idx]; - frequency_string(buf, sizeof buf, delta, ""); + frequency_string_short(buf, sizeof buf, frequencies[idx] - frequencies[idx0], 0); } 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)); @@ -1718,8 +1722,10 @@ cell_draw_marker_info(int m, int n, int w, int h) trace_get_info(t, buf, sizeof buf); 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); + setForegroundColor(DEFAULT_FG_COLOR); cell_drawstring(w, h, buf, xpos, ypos); j++; } @@ -1736,6 +1742,7 @@ cell_draw_marker_info(int m, int n, int w, int h) // setForegroundColor(0xffff); // cell_drawstring_invert(w, h, buf, xpos, ypos, uistat.lever_mode == LM_MARKER); // xpos += 14; + setForegroundColor(DEFAULT_FG_COLOR); if (uistat.lever_mode == LM_MARKER) cell_drawstring(w, h, S_SARROW, xpos, ypos); xpos += 5;