diff --git a/main.c b/main.c index 0bb96b3..aff2ec2 100644 --- a/main.c +++ b/main.c @@ -907,6 +907,7 @@ config_t config = { .cor_am = -14, .cor_wfm = -17, .cor_nfm = -17, + .sweep_voltage = 3.3, }; //properties_t current_props; @@ -2348,6 +2349,7 @@ static const VNAShellCommand commands[] = {"time" , cmd_time , 0}, #endif {"dac" , cmd_dac , 0}, + {"sweep_voltage",cmd_sweep_voltage,0}, {"saveconfig" , cmd_saveconfig , 0}, {"clearconfig" , cmd_clearconfig , 0}, {"data" , cmd_data , CMD_WAIT_MUTEX}, diff --git a/nanovna.h b/nanovna.h index 0b94aeb..fbdb3b0 100644 --- a/nanovna.h +++ b/nanovna.h @@ -527,6 +527,7 @@ typedef struct config { int8_t cor_am; int8_t cor_wfm; int8_t cor_nfm; + float sweep_voltage; uint32_t dummy; // uint8_t _reserved[22]; freq_t checksum; diff --git a/plot.c b/plot.c index 9482847..cac69d7 100644 --- a/plot.c +++ b/plot.c @@ -119,7 +119,7 @@ float2int(float v) void update_grid(void) { - freq_t gdigit = 100000000; + freq_t gdigit = 1000000000; freq_t fstart = get_sweep_frequency(ST_START); freq_t fspan = get_sweep_frequency(ST_SPAN); freq_t grid; diff --git a/sa_cmd.c b/sa_cmd.c index 083ec73..da40634 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -246,6 +246,17 @@ VNA_SHELL_FUNCTION(cmd_deviceid) } } +VNA_SHELL_FUNCTION(cmd_sweep_voltage) +{ + float value; + if (argc != 1) { + shell_printf("usage: sweep_voltage {value(0-3.3)}\r\n"\ + "current value: %f\r\n", config.sweep_voltage); + return; + } + value = my_atof(argv[0]); + config.sweep_voltage = value; +} VNA_SHELL_FUNCTION(cmd_rbw) { diff --git a/sa_core.c b/sa_core.c index f79bdc5..a1fc4af 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1698,6 +1698,10 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / } if (setting.mode == M_GENLOW && ( setting.frequency_step != 0 || setting.level_sweep != 0.0 || i == 0)) {// if in low output mode and level sweep or frequency weep is active or at start of sweep + if (i == 0) + set_switch_transmit(); + else + set_switch_off(); float ls=setting.level_sweep; // calculate and set the output level if (ls > 0) ls += 0.5; @@ -2171,7 +2175,7 @@ sweep_again: // stay in sweep loop when output mo return false; } - dacPutChannelX(&DACD2, 0, i*14); // Output sweep voltage + dacPutChannelX(&DACD2, 0, (((float)i)*config.sweep_voltage)*4.279); // Output sweep voltage 4095 -> 3.3 Volt // ----------------------- in loop AGC ---------------------------------