diff --git a/main.c b/main.c index 7a0b8f3..1f321d8 100644 --- a/main.c +++ b/main.c @@ -104,7 +104,7 @@ static void transform_domain(void); static int8_t drive_strength = DRIVE_STRENGTH_AUTO; #endif uint8_t sweep_mode = SWEEP_ENABLE; -uint8_t redraw_request = 0; // contains REDRAW_XXX flags +uint16_t redraw_request = 0; // contains REDRAW_XXX flags uint8_t auto_capture = false; // Version text, displayed in Config->Version menu, also send by info command const char *info_about[]={ @@ -192,7 +192,7 @@ static THD_FUNCTION(Thread1, arg) ui_process(); // Process collected data, calculate trace coordinates and plot only if scan // completed - if (/* sweep_mode & SWEEP_ENABLE && */ completed) { + if ((redraw_request & (CLEAR_ACTUAL | CLEAR_STORED | CLEAR_TEMP) ) || completed) { // START_PROFILE; // Prepare draw graphics, cache all lines, mark screen cells for redraw plot_into_index(measured); diff --git a/nanovna.h b/nanovna.h index 10206be..6888111 100644 --- a/nanovna.h +++ b/nanovna.h @@ -124,7 +124,7 @@ #define MARKER_COUNT 4 #define TRACES_MAX 3 -#define TRACE_ACTUAL 0 +#define TRACE_ACTUAL 0 // order linked to redraw_request flags!!!!! #define TRACE_STORED 1 #define TRACE_TEMP 2 //#define TRACE_AGE 3 @@ -797,7 +797,10 @@ int marker_search_right_min(int from); #define REDRAW_BATTERY (1<<4) #define REDRAW_AREA (1<<5) #define REDRAW_TRIGGER (1<<6) -extern uint8_t redraw_request; +#define CLEAR_ACTUAL (1<<7) +#define CLEAR_STORED (1<<8) +#define CLEAR_TEMP (1<<9) +extern uint16_t redraw_request; /* * ili9341.c @@ -1297,6 +1300,10 @@ void touch_cal_exec(void); void touch_draw_test(void); void enter_dfu(void); +#ifdef TINYSA4 +extern char range_text[20]; +#endif + /* * adc.c */ diff --git a/plot.c b/plot.c index d04a09e..d3ccbe2 100644 --- a/plot.c +++ b/plot.c @@ -24,7 +24,7 @@ #include "nanovna.h" #pragma GCC push_options -#pragma GCC optimize ("O2") // Makes the code just a bit faster, disable during debugging. +#pragma GCC optimize ("Og") // Makes the code just a bit faster, disable during debugging. #ifdef __SCROLL__ uint16_t _grid_y = (CHART_BOTTOM / NGRIDY); @@ -489,6 +489,8 @@ mark_cells_from_index(void) for (t = 0; t < TRACES_MAX; t++) { if (!trace[t].enabled) continue; + if ((CLEAR_ACTUAL << t ) & redraw_request ) + continue; // dirty, do not draw index_y_t *index_y = trace_index_y[t]; int m0 = index_x[0] / CELLWIDTH; int n0 = index_y[0] / CELLHEIGHT; @@ -823,6 +825,9 @@ plot_into_index(measurement_t measured) for (t = 0; t < TRACES_MAX; t++) { if (!trace[t].enabled) continue; + if ((CLEAR_ACTUAL << t ) & redraw_request ) { + continue; // dirty, do not draw + } trace_into_index_y_array(trace_index_y[t], measured[t], sweep_points); } // STOP_PROFILE @@ -945,6 +950,9 @@ draw_cell(int m, int n) for (t = 0; t < TRACES_MAX; t++) { if (!trace[t].enabled) continue; + if ((CLEAR_ACTUAL << t ) & redraw_request ) + continue; // dirty, do not draw + c = GET_PALTETTE_COLOR(LCD_TRACE_1_COLOR + t); index_y_t *index_y = trace_index_y[t]; for (i = i0; i < i1; i++) { diff --git a/sa_core.c b/sa_core.c index b19b61b..4eafa23 100644 --- a/sa_core.c +++ b/sa_core.c @@ -141,6 +141,9 @@ void update_min_max_freq(void) maxFreq = LOW_MAX_FREQ; #else maxFreq = DEFAULT_MAX_FREQ; +#endif +#ifdef TINYSA4 + plot_printf(range_text, sizeof range_text, "%QHz to %QHz", minFreq, maxFreq); #endif break; case M_GENLOW: @@ -170,6 +173,9 @@ void update_min_max_freq(void) #endif break; } +#ifdef TINYSA4 + plot_printf(range_text, sizeof range_text, "%.3QHz to %.3QHz", minFreq, maxFreq); +#endif } void reset_settings(int m) @@ -1080,11 +1086,7 @@ void set_average(int v) && (v != AV_QUASI) #endif ); - if (trace[TRACE_TEMP].enabled) { - for (int i=0; ireference; if (menu->data <= KM_CW) { // One of the frequency input keypads if (MODE_LOW(setting.mode)) - kp_help_text = VARIANT("0..350MHz","0..800MHz"); + kp_help_text = VARIANT("0..350MHz",range_text); else - kp_help_text = VARIANT("240..960Mhz","136..4350MHz"); + kp_help_text = VARIANT("240..960Mhz",range_text); } ui_mode_keypad(menu->data); redraw_request |= REDRAW_CAL_STATUS; diff --git a/ui_sa.c b/ui_sa.c index 87c6c51..4a622f2 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -518,6 +518,7 @@ static const menuitem_t menu_curve_confirm[]; #endif static const menuitem_t menu_sweep[]; extern bool dirty; +char range_text[20]; static UI_FUNCTION_ADV_CALLBACK(menu_sweep_acb) { @@ -1942,7 +1943,7 @@ static const menuitem_t menu_modulation[] = { }; static const menuitem_t menu_sweep[] = { - { MT_FORM | MT_KEYPAD, KM_SPAN, "SPAN: %s", VARIANT("0..350MHz", "0..800MHz")}, + { MT_FORM | MT_KEYPAD, KM_SPAN, "SPAN: %s", VARIANT("0..350MHz", range_text)}, { MT_FORM | MT_KEYPAD | MT_LOW, KM_LEVELSWEEP,"LEVEL CHANGE: %s", VARIANT("-70..70","-90..90")}, { MT_FORM | MT_KEYPAD, KM_SWEEP_TIME, "SWEEP TIME: %s", "0..600 seconds"}, { MT_FORM | MT_SUBMENU, 0, "SWEEP POINTS", menu_sweep_points_form}, @@ -1973,7 +1974,7 @@ static const menuitem_t menu_lowoutputmode[] = { static const menuitem_t menu_highoutputmode[] = { { MT_FORM | MT_ADV_CALLBACK, 0, "HIGH OUTPUT %s", menu_outputmode_acb}, - { MT_FORM | MT_KEYPAD, KM_CENTER, center_text, VARIANT("240MHz..960MHz","136MHz..4350MHz")}, + { MT_FORM | MT_KEYPAD, KM_CENTER, center_text, VARIANT("240MHz..960MHz",range_text)}, { MT_FORM | MT_KEYPAD, KM_HIGHOUTLEVEL, "LEVEL: %s", low_level_help_text /* "-76..-6" */}, { MT_FORM | MT_ADV_CALLBACK, 0, "MOD: %s", menu_smodulation_acb}, { MT_FORM | MT_ADV_CALLBACK, 0, "%s", menu_sweep_acb},