diff --git a/main.c b/main.c index 4bd8be1..68b3505 100644 --- a/main.c +++ b/main.c @@ -2686,6 +2686,7 @@ int main(void) set_mode(M_LOW); sweep(true); + setting.refer = -1; ui_mode_menu(); // Show menu when autostarting mode diff --git a/nanovna.h b/nanovna.h index eb496af..e3c5a57 100644 --- a/nanovna.h +++ b/nanovna.h @@ -351,7 +351,7 @@ enum trace_type { #define MAX_UNIT_TYPE 4 enum unit_type { - U_DBM=0, U_DBMV, U_DBUV, U_VOLT, U_WATT + U_DBM=0, U_DBMV, U_DBUV, U_VOLT, U_WATT, U_DBC // dBc only for displaying delta marker info }; #define UNIT_IS_LINEAR(T) ( T >= U_VOLT ? true : false) #define UNIT_IS_LOG(T) ( T >= U_VOLT ? false : true) diff --git a/plot.c b/plot.c index 1a04554..4b80199 100644 --- a/plot.c +++ b/plot.c @@ -843,6 +843,7 @@ static void trace_get_value_string( uint32_t dfreq = 0; float rlevel = 0; int ii = i; + int unit_index = setting.unit; if (mtype & M_DELTA) { if (ri > i) { dfreq = frequencies[ri] - frequencies[i]; @@ -854,11 +855,15 @@ static void trace_get_value_string( buf2[0] = '+'; } rlevel = value(coeff[ri]); + unit_index = U_DBC; } else { dfreq = frequencies[i]; } if (FREQ_IS_CW()) { float t = ii*(setting.actual_sweep_time)*1000.0/290.0; +#if 1 + plot_printf(&buf2[1], sizeof(buf2) -1, "%.3FS" , t/1000000.0); +#else if (t>1000000.0){ plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/1000000.0); buf2[5] = 'S'; @@ -876,6 +881,7 @@ static void trace_get_value_string( buf2[6] = 'S'; buf2[7]=0; } +#endif } else { uint32_t resolution = get_sweep_frequency(ST_SPAN)/290; if (resolution <= 2000) @@ -898,7 +904,7 @@ static void trace_get_value_string( } else { plot_printf(buf3, sizeof(buf3), "%.1f", v); } - plot_printf(buf, len, "%s %s%s%s", buf2, buf3, unit_string[setting.unit],(mtype & M_NOISE?"/Hz":"")); + plot_printf(buf, len, "%s %s%s%s", buf2, buf3, unit_string[unit_index],(mtype & M_NOISE?"/Hz":"")); } } @@ -1580,13 +1586,13 @@ draw_all_cells(bool flush_markmap) clear_markmap(); } #ifdef __SCROLL__ - int w = area_width - 5; + int w = area_width; if (w < 5) w = 5; if (waterfall) { for (m = 226; m >= HEIGHT+3; m -= 1) { // Scroll down uint16_t *buf = &spi_buffer[0]; - ili9341_read_memory(5*5, m, w, 1, w, buf); - ili9341_bulk(5*5,m+1, w,1); + ili9341_read_memory(6*5, m, w, 1, w, buf); + ili9341_bulk(6*5,m+1, w,1); } for (int i=0; i<290; i++) { // Add new topline #if 0 @@ -1678,7 +1684,7 @@ draw_all_cells(bool flush_markmap) #endif spi_buffer[i] = RGB565(r,g,b); } - ili9341_bulk(5*5,HEIGHT+3, w,1); + ili9341_bulk(6*5,HEIGHT+3, w,1); } #endif } diff --git a/sa_core.c b/sa_core.c index 20f0342..dc6f861 100644 --- a/sa_core.c +++ b/sa_core.c @@ -58,7 +58,7 @@ void reset_settings(int m) setting.linearity_step = 0; trace[TRACE_STORED].enabled = false; trace[TRACE_TEMP].enabled = false; - setting.refer = -1; +// setting.refer = -1; // do not reset reffer when switching modes setting.mute = true; #ifdef __SPUR__ setting.spur = 0; @@ -1816,7 +1816,7 @@ float my_round(float v) return v; } -const char * const unit_string[] = { "dBm", "dBmV", "dBuV", "V", "W" }; +const char * const unit_string[] = { "dBm", "dBmV", "dBuV", "V", "W", "dBc" }; static const float scale_value[]={50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20,10,5,2,1,0.5,0.2,0.1,0.05,0.02,0.01,0.005,0.002, 0.001,0.0005,0.0002, 0.0001}; static const char * const scale_vtext[]= {"50000", "20000", "10000", "5000", "2000", "1000", "500", "200", "100", "50", "20","10","5","2","1","0.5","0.2","0.1","0.05","0.02","0.01", "0.005","0.002","0.001", "0.0005","0.0002","0.0001"}; diff --git a/ui_sa.c b/ui_sa.c index 967138a..fbbe6e9 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1373,12 +1373,12 @@ static const menuitem_t menu_scanning_speed[] = static const menuitem_t menu_settings2[] = { - { MT_CALLBACK, 1, "AGC", menu_settings2_cb}, - { MT_CALLBACK, 2, "LNA", menu_settings2_cb}, - { MT_CALLBACK | MT_LOW, 3, "BPF", menu_settings2_cb}, - { MT_CALLBACK | MT_LOW, 4, "\2BELOW\0IF", menu_settings2_cb}, - { MT_KEYPAD, KM_DECAY,"\2HOLD\0TIME", "1..1000"}, - { MT_KEYPAD, KM_NOISE,"\2NOISE\0LEVEL", "2..20"}, + { MT_CALLBACK, 1, "AGC", menu_settings2_cb}, + { MT_CALLBACK, 2, "LNA", menu_settings2_cb}, + { MT_CALLBACK | MT_LOW, 3, "BPF", menu_settings2_cb}, + { MT_CALLBACK | MT_LOW, 4, "\2BELOW\0IF", menu_settings2_cb}, + { MT_KEYPAD, KM_DECAY, "\2HOLD\0SWEEPS", "1..1000"}, + { MT_KEYPAD, KM_NOISE, "\2NOISE\0LEVEL", "2..20"}, #ifdef __ULTRA__ { MT_SUBMENU,0, "HARMONIC", menu_harmonic}, #endif