Check calibration levels

pull/51/head
erikkaashoek 3 years ago
parent 328911d5d5
commit 65f6118b8a

@ -978,7 +978,7 @@ VNA_SHELL_FUNCTION(cmd_z)
return; return;
} }
if (argc == 1) { if (argc == 1) {
setting.step_delay = atoi(argv[0]); setting.step_delay = my_atoi(argv[0]);
dirty = true; dirty = true;
} }
} }
@ -990,7 +990,7 @@ VNA_SHELL_FUNCTION(cmd_n)
return; return;
} }
if (argc == 1) { if (argc == 1) {
setting.offset_delay = atoi(argv[0]); setting.offset_delay = my_atoi(argv[0]);
dirty = true; dirty = true;
} }
} }
@ -1321,8 +1321,8 @@ again:
switch (m) { switch (m) {
default: goto usage; default: goto usage;
case 's': test_output_switch = *a - '0'; break; case 's': test_output_switch = *a - '0'; break;
case 'd': test_output_drive = atoi(a); break; case 'd': test_output_drive = my_atoi(a); break;
case 'a': test_output_attenuate = atoi(a); break; case 'a': test_output_attenuate = my_atoi(a); break;
#ifdef TINYSA4 #ifdef TINYSA4
case 'p': test_path = *a - '0'; break; case 'p': test_path = *a - '0'; break;
#endif #endif

@ -18,6 +18,7 @@
#include "si4432.h" // comment out for simulation #include "si4432.h" // comment out for simulation
//#endif //#endif
#include "stdlib.h" #include "stdlib.h"
//#define TINYSA4
#pragma GCC push_options #pragma GCC push_options
#ifdef TINYSA4 #ifdef TINYSA4
@ -2795,7 +2796,7 @@ void interpolate_maximum(int m)
const INTER_TYPE y1 = ref_marker_levels[idx - 1]; const INTER_TYPE y1 = ref_marker_levels[idx - 1];
const INTER_TYPE y2 = ref_marker_levels[idx + 0]; const INTER_TYPE y2 = ref_marker_levels[idx + 0];
const INTER_TYPE y3 = ref_marker_levels[idx + 1]; const INTER_TYPE y3 = ref_marker_levels[idx + 1];
const INTER_TYPE d = abs(delta_Hz) * 0.5 * (y1 - y3) / ((y1 - (2 * y2) + y3) + 1e-12); const INTER_TYPE d = fabs(delta_Hz) * 0.5 * (y1 - y3) / ((y1 - (2 * y2) + y3) + 1e-12);
//const float bin = (float)idx + d; //const float bin = (float)idx + d;
markers[m].frequency += d; markers[m].frequency += d;
} }
@ -7450,7 +7451,6 @@ void calibrate(void)
{ {
int local_test_status; int local_test_status;
int old_sweep_points = setting._sweep_points; int old_sweep_points = setting._sweep_points;
reset_calibration();
#ifdef TINYSA4 #ifdef TINYSA4
int old_ultra = config.ultra; int old_ultra = config.ultra;
config.ultra = true; config.ultra = true;
@ -7516,6 +7516,7 @@ void calibrate(void)
#endif #endif
#endif #endif
reset_calibration();
in_calibration = true; in_calibration = true;
for (calibration_stage = CS_NORMAL; calibration_stage < CS_MAX ; calibration_stage++) { for (calibration_stage = CS_NORMAL; calibration_stage < CS_MAX ; calibration_stage++) {
for (int k = 0; k<3; k++) { for (int k = 0; k<3; k++) {
@ -7594,7 +7595,7 @@ void calibrate(void)
local_test_status = test_validate(test_case); local_test_status = test_validate(test_case);
calibration_busy(); calibration_busy();
} }
local_test_status = TS_PASS; local_test_status = TS_PASS; // Must be forced because test_validate calculates pass band wrong
#else #else
// set_RBW(power_rbw[j]); // set_RBW(power_rbw[j]);
// set_sweep_points(21); // set_sweep_points(21);
@ -7634,7 +7635,13 @@ void calibrate(void)
local_test_status = test_validate(test_case); // Validate test also sets attenuation if zero span local_test_status = test_validate(test_case); // Validate test also sets attenuation if zero span
#endif #endif
#endif #endif
if (calibration_stage == CS_NORMAL && peakLevel < -40) { if ((calibration_stage == CS_NORMAL && peakLevel < -40)
#ifdef TINYSA4
|| (calibration_stage == CS_LNA && peakLevel < -40)
|| (calibration_stage == CS_ULTRA && peakLevel < -40)
|| (calibration_stage == CS_DIRECT && peakLevel < direct_level - 10)
#endif
) {
#ifdef TINYSA4 #ifdef TINYSA4
low_level: low_level:
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.