diff --git a/nanovna.h b/nanovna.h index 85b65cb..b53a70f 100644 --- a/nanovna.h +++ b/nanovna.h @@ -668,9 +668,9 @@ typedef struct config { float high_level_offset; float low_level_output_offset; float high_level_output_offset; + float receive_switch_offset; #ifdef TINYSA4 float lna_level_offset; - float receive_switch_offset; float harmonic_level_offset; float shift_level_offset; #endif diff --git a/sa_cmd.c b/sa_cmd.c index 896c88a..75924bf 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -309,7 +309,7 @@ VNA_SHELL_FUNCTION(cmd_leveloffset) #ifdef TINYSA4 static const char cmd_mode_list[] = "low|high|switch|receive_switch|lna|harmonic|shift"; #else - static const char cmd_mode_list[] = "low|high|switch"; + static const char cmd_mode_list[] = "low|high|switch|receive_switch"; #endif if (argc == 0) { const char *p = "leveloffset %s %.1f\r\n"; @@ -318,8 +318,8 @@ VNA_SHELL_FUNCTION(cmd_leveloffset) shell_printf(p, "low output", config.low_level_output_offset); shell_printf(p, "high output", config.high_level_output_offset); shell_printf(p, "switch", config.switch_offset); -#ifdef TINYSA4 shell_printf(p, "receive_switch",config.receive_switch_offset); +#ifdef TINYSA4 shell_printf(p, "lna", config.lna_level_offset); shell_printf(p, "harmonic", config.harmonic_level_offset); shell_printf(p, "shift", config.shift_level_offset); @@ -335,8 +335,8 @@ VNA_SHELL_FUNCTION(cmd_leveloffset) case 0: config.low_level_offset = v; break; case 1: config.high_level_offset = v; break; case 2: config.switch_offset = v; break; -#ifdef TINYSA4 case 3: config.receive_switch_offset = v; break; +#ifdef TINYSA4 case 4: config.lna_level_offset = v; break; case 5: config.harmonic_level_offset = v; break; case 6: config.shift_level_offset = v; break; diff --git a/sa_core.c b/sa_core.c index c91c406..0dde2cd 100644 --- a/sa_core.c +++ b/sa_core.c @@ -123,7 +123,7 @@ const int8_t drive_dBm [16] = {-38, -32, -30, -27, -24, -19, -15, -12, -5, -2, 0 #else #define SWITCH_ATTENUATION (29 - config.switch_offset) -#define RECEIVE_SWITCH_ATTENUATION 24 +#define RECEIVE_SWITCH_ATTENUATION (24 - config.receive_switch_offset) #define POWER_OFFSET 15 #define MAX_DRIVE (setting.mode == M_GENHIGH ? 13 : 11) // The value of 13 is linked to the SL_GENHIGH_LEVEL_MAX of 9 #define MIN_DRIVE 8 @@ -1091,11 +1091,9 @@ void set_actual_power(float o) // Set peak level to known value else #endif { -#ifdef TINYSA4 if (setting.atten_step) config.receive_switch_offset -= new_offset; else -#endif config.low_level_offset = new_offset; } } @@ -6239,9 +6237,9 @@ void calibrate(void) reset_calibration(); #ifdef TINYSA4 bool calibrate_lna = false; +#endif bool calibrate_switch = false; again: -#endif for (int k = 0; k<2; k++) { for (int j= 0; j < CALIBRATE_RBWS; j++ ) { #if 1 @@ -6252,8 +6250,8 @@ again: set_sweep_frequency(ST_SPAN, 5000000); setting.rbw_x10 = 3000; int test_case = TEST_POWER; -#ifdef TINYSA4 setting.atten_step = calibrate_switch; +#ifdef TINYSA4 if (!calibrate_switch) set_extra_lna(calibrate_lna); #endif @@ -6326,11 +6324,11 @@ again: calibrate_lna = true; goto again; } +#endif if (!calibrate_switch) { calibrate_switch = true; goto again; } -#endif #if 0 // No high input calibration as CAL OUTPUT is unreliable set_RBW(100); diff --git a/ui.c b/ui.c index 3424666..8a5840a 100644 --- a/ui.c +++ b/ui.c @@ -287,7 +287,7 @@ touch_start_watchdog(void) if (touch_status_flag&TOUCH_INTERRUPT_ENABLED) return; touch_status_flag^=TOUCH_INTERRUPT_ENABLED; adc_start_analog_watchdog(); -#ifdef REMOTE_DESKTOP +#ifdef __REMOTE_DESKTOP__ remote_mouse_down = 0; #endif } @@ -337,7 +337,7 @@ touch_check(void) last_touch_x = x; last_touch_y = y; } -#ifdef REMOTE_DESKTOP +#ifdef __REMOTE_DESKTOP__ remote_mouse_down = 0; } else { stat = remote_mouse_down == 1;