pull/34/head
erikkaashoek 3 years ago
parent 11ad1b1628
commit 767d965e8b

@ -2057,6 +2057,7 @@ static const VNAShellCommand commands[] =
{ "agc", cmd_agc, CMD_RUN_IN_LOAD },
#endif
{ "actual_freq", cmd_actual_freq, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD },
{ "freq_corr", cmd_freq_correction, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD },
{ "attenuate", cmd_attenuate, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD },
{ "level", cmd_level, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD },
{ "sweeptime", cmd_sweeptime, CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD },

@ -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
@ -457,7 +457,8 @@ void clear_frequency_cache(void);
void toggle_high_out_adf4350(void);
extern int high_out_adf4350;
#endif
int set_actual_freq(int);
int set_actual_freq(freq_t);
int set_freq_corr(int);
void set_IF2(int f);
void set_R(int f);
extern void set_modulo(uint32_t f);

@ -605,12 +605,24 @@ VNA_SHELL_FUNCTION(cmd_if1)
VNA_SHELL_FUNCTION(cmd_actual_freq)
{
if (argc != 1 || argv[0][0] == '?') {
shell_printf("%DHz\r\n", config.setting_frequency_30mhz);
shell_printf("%D\r\n", config.setting_frequency_30mhz);
return;
} else {
set_actual_freq(my_atoui(argv[0]));
}
}
VNA_SHELL_FUNCTION(cmd_freq_correction)
{
if (argc != 1 || argv[0][0] == '?') {
shell_printf("%d ppb\r\n", (int)(((int64_t)config.setting_frequency_30mhz - (int64_t)3000000000ULL)/3));
return;
} else {
set_freq_corr(my_atoi(argv[0]));
}
}
#endif

@ -819,7 +819,7 @@ void set_gridlines(int d)
#ifdef TINYSA4
int set_actual_freq(int f)
int set_freq_corr(int f)
{
if (f < - 100000 || f > +100000)
return -1;
@ -830,6 +830,18 @@ int set_actual_freq(int f)
update_grid();
return 0;
}
int set_actual_freq(freq_t f)
{
if (f < 3000000000 - 30000 || f > 3000000000 + 30000)
return -1;
config.setting_frequency_30mhz =f;
ADF4351_recalculate_PFDRFout();
config_save();
dirty = true;
update_grid();
return 0;
}
#else
void set_10mhz(freq_t f)
{
@ -5326,7 +5338,7 @@ static volatile int dummy;
}
}
}
}
#define __MIRROR_MASKING__
@ -5414,7 +5426,7 @@ static volatile int dummy;
#endif
#endif
calculate_static_correction(); // Update correction
// dirty = true; // Needed to recalculate the correction factor
// dirty = true; // Needed to recalculate the correction factor
}
}
@ -5629,7 +5641,7 @@ static volatile int dummy;
}
#endif
}
// } while (MODE_OUTPUT(setting.mode) && setting.modulation != MO_NONE); // Never exit sweep loop while in output mode with modulation
#if 0 // Read ADC
extern int fix_fft(short fr[], short fi[], short m, short inverse);

@ -575,7 +575,7 @@ char range_text[20];
#ifdef TINYSA4
int input_is_calibrated(void)
{
if (!config.input_is_calibrated)
if (config.input_is_calibrated)
return true;
drawMessageBox("Error", "First calibrate 100kHz to 5.34GHz input", 2000);
redraw_request|= REDRAW_AREA;
@ -584,7 +584,7 @@ int input_is_calibrated(void)
int output_is_calibrated(void)
{
if (!config.output_is_calibrated)
if (config.output_is_calibrated)
return true;
drawMessageBox("Error", "First calibrate 30MHz output", 2000);
redraw_request|= REDRAW_AREA;

Loading…
Cancel
Save

Powered by TurnKey Linux.