Added actual_freq command

Removed_REF_marker
erikkaashoek 5 years ago
parent ab037a2917
commit a43c28055b

@ -2470,6 +2470,7 @@ static const VNAShellCommand commands[] =
{ "if1", cmd_if1, 0 }, { "if1", cmd_if1, 0 },
{ "lna2", cmd_lna2, 0 }, { "lna2", cmd_lna2, 0 },
{ "agc", cmd_agc, 0 }, { "agc", cmd_agc, 0 },
{ "actual_freq", cmd_actual_freq, CMD_WAIT_MUTEX },
#endif #endif
{ "attenuate", cmd_attenuate, 0 }, { "attenuate", cmd_attenuate, 0 },
{ "level", cmd_level, 0 }, { "level", cmd_level, 0 },

@ -1159,7 +1159,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200 //sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e4b /* 'CONF' */ #define CONFIG_MAGIC 0x434f4e4e /* 'CONF' */
extern int16_t lastsaveid; extern int16_t lastsaveid;
//extern properties_t *active_props; //extern properties_t *active_props;

@ -446,8 +446,19 @@ VNA_SHELL_FUNCTION(cmd_if1)
config_save(); config_save();
} }
} }
VNA_SHELL_FUNCTION(cmd_actual_freq)
{
if (argc != 1) {
shell_printf("%DHz\r\n", config.setting_frequency_30mhz);
return;
} else {
set_30mhz(my_atoui(argv[0]));
}
}
#endif #endif
VNA_SHELL_FUNCTION(cmd_trigger) VNA_SHELL_FUNCTION(cmd_trigger)
{ {
if (argc == 0) if (argc == 0)

@ -419,8 +419,6 @@ void set_gridlines(int d)
update_grid(); update_grid();
} }
//int setting_frequency_10mhz = 10000000;
#ifdef TINYSA4 #ifdef TINYSA4
void set_30mhz(freq_t f) void set_30mhz(freq_t f)
{ {
@ -4157,7 +4155,7 @@ static bool sweep(bool break_on_operation)
markers[2].enabled = search_maximum(2, frequencies[markers[0].index]*3, 12); markers[2].enabled = search_maximum(2, frequencies[markers[0].index]*3, 12);
markers[3].enabled = search_maximum(3, frequencies[markers[0].index]*4, 16); markers[3].enabled = search_maximum(3, frequencies[markers[0].index]*4, 16);
#ifdef TINYSA4 #ifdef TINYSA4
} else if (setting.measurement == M_AM && markers[0].index > 10) { // ----------IOP measurement } else if (setting.measurement == M_AM && markers[0].index > 10) { // ----------AM measurement
int l = markers[1].index; int l = markers[1].index;
int r = markers[2].index; int r = markers[2].index;
if (r < l) { if (r < l) {

@ -1227,6 +1227,9 @@ void Si446x_getInfo(si446x_info_t* info)
info->func = data[5]; info->func = data[5];
} }
float old_temp = -100;
#define TEMP_HISTERESE 0.5
float Si446x_get_temp(void) float Si446x_get_temp(void)
{ {
uint8_t data[8] = { SI446X_CMD_GET_ADC_READING, 0x10, 0 }; uint8_t data[8] = { SI446X_CMD_GET_ADC_READING, 0x10, 0 };
@ -1236,6 +1239,10 @@ float Si446x_get_temp(void)
i = 6; i = 6;
float t = (data[i] << 8) + data[i+1]; float t = (data[i] << 8) + data[i+1];
t = (899.0 * t /4096.0) - 293.0; t = (899.0 * t /4096.0) - 293.0;
if (t > old_temp - TEMP_HISTERESE && t < old_temp + TEMP_HISTERESE) {
return(old_temp);
}
old_temp = t;
return t; return t;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.