diff --git a/nanovna.h b/nanovna.h index 713da9d..54614c3 100644 --- a/nanovna.h +++ b/nanovna.h @@ -18,7 +18,7 @@ */ #include "ch.h" -//#ifdef TINYSA_F303 +#ifdef TINYSA_F303 #ifdef TINYSA_F072 #error "Remove comment for #ifdef TINYSA_F303" #endif @@ -26,7 +26,7 @@ #define TINYSA4 #endif #define TINYSA4_PROTO -//#endif +#endif #ifdef TINYSA_F072 #ifdef TINYSA_F303 @@ -1156,7 +1156,7 @@ void set_trace_refpos(float refpos); #define S_STATE(X) ((X)&1) enum { S_OFF=0, S_ON=1, S_AUTO_OFF=2, S_AUTO_ON=3 }; -enum { SD_NORMAL, SD_PRECISE, SD_FAST, SD_MANUAL }; +enum { SD_NORMAL, SD_PRECISE, SD_FAST, SD_NOISE_SOURCE, SD_MANUAL }; enum {W_OFF, W_SMALL, W_BIG}; diff --git a/plot.c b/plot.c index c7a6700..e482533 100644 --- a/plot.c +++ b/plot.c @@ -2077,8 +2077,13 @@ static void update_level_meter(void){ // ili9341_fill(OFFSETX+minimum_text_width, graph_bottom+1, area_width-minimum_text_width, CHART_BOTTOM - graph_bottom); ili9341_set_foreground(LCD_FG_COLOR); int x_max = area_width+OFFSETX; - int w = ili9341_drawstring_size(level_text,OFFSETX, graph_bottom+1,3, x_max); // TODO Size 4 does not transfer to remote desktop?????? - ili9341_fill(OFFSETX, graph_bottom+34, x_max - OFFSETX, 11); +#ifdef TINYSA4 +#define BIG_SIZE 5 +#else +#define BIG_SIZE 3 +#endif + int w = ili9341_drawstring_size(level_text,OFFSETX, graph_bottom+1,BIG_SIZE, x_max); // TODO Size 4 does not transfer to remote desktop?????? + ili9341_fill(OFFSETX, graph_bottom+BIG_SIZE*11+1, x_max - OFFSETX, CHART_BOTTOM - (graph_bottom+BIG_SIZE*11+1) + 1); if (w < x_max) ili9341_fill(w, graph_bottom+1, x_max - w, CHART_BOTTOM - graph_bottom+1); diff --git a/sa_core.c b/sa_core.c index 2404017..9444c14 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1246,9 +1246,9 @@ void set_harmonic(int h) void set_step_delay(int d) // override RSSI measurement delay or set to one of three auto modes { - if ((3 <= d && d < 10) || d > 30000) // values 0 (normal scan), 1 (precise scan) and 2(fast scan) have special meaning and are auto calculated + if ((SD_MANUAL <= d && d < 10) || d > 30000) // values 0 (normal scan), 1 (precise scan) and 2(fast scan) have special meaning and are auto calculated return; - if (d <3) { + if (d 0) { freq_t target_frequency_step_x10; - if (setting.step_delay_mode==SD_FAST) { + if (setting.step_delay_mode==SD_FAST || setting.step_delay_mode==SD_NOISE_SOURCE) { target_frequency_step_x10 = frequency_step_x10; } else if (setting.step_delay_mode==SD_PRECISE) { target_frequency_step_x10 = 4*frequency_step_x10; @@ -2287,7 +2287,7 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# target_frequency_step_x10 = 2*frequency_step_x10; } - if (target_frequency_step_x10 > actual_rbw_x10) { // RBW too small + if (target_frequency_step_x10 > actual_rbw_x10 && !(setting.step_delay_mode==SD_NOISE_SOURCE)) { // RBW too small vbwSteps = (target_frequency_step_x10 + actual_rbw_x10 - 1) / actual_rbw_x10; //((int)(2 * (frequency_step_x10 + (actual_rbw_x10/8)) / actual_rbw_x10)); // calculate # steps in between each frequency step due to rbw being less than frequency step if (vbwSteps<1) vbwSteps = 1; diff --git a/ui_sa.c b/ui_sa.c index 5178ce2..81ce3d4 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -2649,6 +2649,7 @@ static const menuitem_t menu_sweep_speed[] = #else { MT_ADV_CALLBACK | MT_LOW,SD_FAST, "FAST", menu_scanning_speed_acb}, #endif + { MT_ADV_CALLBACK, SD_NOISE_SOURCE, "NOISE\nSOURCE", menu_scanning_speed_acb}, #ifdef TINYSA4 { MT_KEYPAD, KM_FAST_SPEEDUP,"SPEEDUP\n\b%s", "2..20, 0=disable"}, #else @@ -3782,16 +3783,16 @@ redraw_cal_status: } #endif // Sweep time: SD_NORMAL, SD_PRECISE, SD_FAST, SD_MANUAL - static const char fscan[]={0, 'P', 'F', 'M'}; + static const char fscan[]={0, 'P', 'F', 'N', 'M'}; if (dirty) { calculate_step_delay(); setting.actual_sweep_time_us = calc_min_sweep_time_us(); } #if 0 // Activate for sweep time debugging - lcd_printf(x, y, "%cScan:\n%5.3Fs", fscan[setting.step_delay_mode&3], (float)setting.sweep_time_us/ONE_SECOND_TIME); + lcd_printf(x, y, "%cScan:\n%5.3Fs", fscan[setting.step_delay_mode&7], (float)setting.sweep_time_us/ONE_SECOND_TIME); #endif - ili9341_set_foreground((setting.step_delay_mode&3) != 0 ? LCD_BRIGHT_COLOR_GREEN : LCD_FG_COLOR); - lcd_printf(x, y, "%cScan:", fscan[setting.step_delay_mode&3]); + ili9341_set_foreground((setting.step_delay_mode&7) != 0 ? LCD_BRIGHT_COLOR_GREEN : LCD_FG_COLOR); + lcd_printf(x, y, "%cScan:", fscan[setting.step_delay_mode&7]); ili9341_set_foreground((setting.step_delay || setting.sweep_time_us ) ? LCD_BRIGHT_COLOR_GREEN : LCD_FG_COLOR); lcd_printf(x, y+YSTEP, "%5.3Fs",(float)setting.actual_sweep_time_us/ONE_SECOND_TIME); y = add_quick_menu(y+=YSTEP, (menuitem_t *)menu_sweep_speed);