Remote desktop bug solved & receive switch calibration added

Speed-test
erikkaashoek 4 years ago
parent 5b97b35307
commit b409a7b993

@ -668,9 +668,9 @@ typedef struct config {
float high_level_offset; float high_level_offset;
float low_level_output_offset; float low_level_output_offset;
float high_level_output_offset; float high_level_output_offset;
float receive_switch_offset;
#ifdef TINYSA4 #ifdef TINYSA4
float lna_level_offset; float lna_level_offset;
float receive_switch_offset;
float harmonic_level_offset; float harmonic_level_offset;
float shift_level_offset; float shift_level_offset;
#endif #endif

@ -309,7 +309,7 @@ VNA_SHELL_FUNCTION(cmd_leveloffset)
#ifdef TINYSA4 #ifdef TINYSA4
static const char cmd_mode_list[] = "low|high|switch|receive_switch|lna|harmonic|shift"; static const char cmd_mode_list[] = "low|high|switch|receive_switch|lna|harmonic|shift";
#else #else
static const char cmd_mode_list[] = "low|high|switch"; static const char cmd_mode_list[] = "low|high|switch|receive_switch";
#endif #endif
if (argc == 0) { if (argc == 0) {
const char *p = "leveloffset %s %.1f\r\n"; 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, "low output", config.low_level_output_offset);
shell_printf(p, "high output", config.high_level_output_offset); shell_printf(p, "high output", config.high_level_output_offset);
shell_printf(p, "switch", config.switch_offset); shell_printf(p, "switch", config.switch_offset);
#ifdef TINYSA4
shell_printf(p, "receive_switch",config.receive_switch_offset); shell_printf(p, "receive_switch",config.receive_switch_offset);
#ifdef TINYSA4
shell_printf(p, "lna", config.lna_level_offset); shell_printf(p, "lna", config.lna_level_offset);
shell_printf(p, "harmonic", config.harmonic_level_offset); shell_printf(p, "harmonic", config.harmonic_level_offset);
shell_printf(p, "shift", config.shift_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 0: config.low_level_offset = v; break;
case 1: config.high_level_offset = v; break; case 1: config.high_level_offset = v; break;
case 2: config.switch_offset = v; break; case 2: config.switch_offset = v; break;
#ifdef TINYSA4
case 3: config.receive_switch_offset = v; break; case 3: config.receive_switch_offset = v; break;
#ifdef TINYSA4
case 4: config.lna_level_offset = v; break; case 4: config.lna_level_offset = v; break;
case 5: config.harmonic_level_offset = v; break; case 5: config.harmonic_level_offset = v; break;
case 6: config.shift_level_offset = v; break; case 6: config.shift_level_offset = v; break;

@ -123,7 +123,7 @@ const int8_t drive_dBm [16] = {-38, -32, -30, -27, -24, -19, -15, -12, -5, -2, 0
#else #else
#define SWITCH_ATTENUATION (29 - config.switch_offset) #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 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 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 #define MIN_DRIVE 8
@ -1091,11 +1091,9 @@ void set_actual_power(float o) // Set peak level to known value
else else
#endif #endif
{ {
#ifdef TINYSA4
if (setting.atten_step) if (setting.atten_step)
config.receive_switch_offset -= new_offset; config.receive_switch_offset -= new_offset;
else else
#endif
config.low_level_offset = new_offset; config.low_level_offset = new_offset;
} }
} }
@ -6239,9 +6237,9 @@ void calibrate(void)
reset_calibration(); reset_calibration();
#ifdef TINYSA4 #ifdef TINYSA4
bool calibrate_lna = false; bool calibrate_lna = false;
#endif
bool calibrate_switch = false; bool calibrate_switch = false;
again: again:
#endif
for (int k = 0; k<2; k++) { for (int k = 0; k<2; k++) {
for (int j= 0; j < CALIBRATE_RBWS; j++ ) { for (int j= 0; j < CALIBRATE_RBWS; j++ ) {
#if 1 #if 1
@ -6252,8 +6250,8 @@ again:
set_sweep_frequency(ST_SPAN, 5000000); set_sweep_frequency(ST_SPAN, 5000000);
setting.rbw_x10 = 3000; setting.rbw_x10 = 3000;
int test_case = TEST_POWER; int test_case = TEST_POWER;
#ifdef TINYSA4
setting.atten_step = calibrate_switch; setting.atten_step = calibrate_switch;
#ifdef TINYSA4
if (!calibrate_switch) if (!calibrate_switch)
set_extra_lna(calibrate_lna); set_extra_lna(calibrate_lna);
#endif #endif
@ -6326,11 +6324,11 @@ again:
calibrate_lna = true; calibrate_lna = true;
goto again; goto again;
} }
#endif
if (!calibrate_switch) { if (!calibrate_switch) {
calibrate_switch = true; calibrate_switch = true;
goto again; goto again;
} }
#endif
#if 0 // No high input calibration as CAL OUTPUT is unreliable #if 0 // No high input calibration as CAL OUTPUT is unreliable
set_RBW(100); set_RBW(100);

@ -287,7 +287,7 @@ touch_start_watchdog(void)
if (touch_status_flag&TOUCH_INTERRUPT_ENABLED) return; if (touch_status_flag&TOUCH_INTERRUPT_ENABLED) return;
touch_status_flag^=TOUCH_INTERRUPT_ENABLED; touch_status_flag^=TOUCH_INTERRUPT_ENABLED;
adc_start_analog_watchdog(); adc_start_analog_watchdog();
#ifdef REMOTE_DESKTOP #ifdef __REMOTE_DESKTOP__
remote_mouse_down = 0; remote_mouse_down = 0;
#endif #endif
} }
@ -337,7 +337,7 @@ touch_check(void)
last_touch_x = x; last_touch_x = x;
last_touch_y = y; last_touch_y = y;
} }
#ifdef REMOTE_DESKTOP #ifdef __REMOTE_DESKTOP__
remote_mouse_down = 0; remote_mouse_down = 0;
} else { } else {
stat = remote_mouse_down == 1; stat = remote_mouse_down == 1;

Loading…
Cancel
Save

Powered by TurnKey Linux.