Repair sweep command to include sweep points

pull/4/head
erikkaashoek 5 years ago
parent 03772830ce
commit 38e4fcd143

@ -1210,29 +1210,30 @@ VNA_SHELL_FUNCTION(cmd_sweep)
}
uint32_t value0 = 0;
uint32_t value1 = 0;
uint32_t value2 = 0;
if (argc >= 1) value0 = my_atoui(argv[0]);
if (argc >= 2) value1 = my_atoui(argv[1]);
if (argc >= 3) value2 = my_atoui(argv[2]);
#if MAX_FREQ_TYPE != 5
#error "Sweep mode possibly changed, check cmd_sweep function"
#endif
// Parse sweep {start|stop|center|span|cw} {freq(Hz)}
// get enum ST_START, ST_STOP, ST_CENTER, ST_SPAN, ST_CW
static const char sweep_cmd[] = "start|stop|center|span|cw";
if (argc == 2 && value0 == 0) {
int type = get_str_index(argv[0], sweep_cmd);
if (type == -1)
goto usage;
int type = get_str_index(argv[0], sweep_cmd);
if (type >=0) {
set_sweep_frequency(type, value1);
return;
}
// Parse sweep {start(Hz)} [stop(Hz)]
if (value0)
set_sweep_frequency(ST_START, value0);
set_sweep_frequency(ST_START, value0);
if (value1)
set_sweep_frequency(ST_STOP, value1);
if (value2)
set_sweep_points(value2);
return;
usage:
shell_printf("usage: sweep {start(Hz)} [stop(Hz)]\r\n"\
shell_printf("usage: sweep {start(Hz)} [stop(Hz)] [points]\r\n"\
"\tsweep {%s} {freq(Hz)}\r\n", sweep_cmd);
}

@ -112,7 +112,7 @@ void reset_settings(int m)
switch(m) {
case M_LOW:
minFreq = 0;
maxFreq = 520000000;
maxFreq = 350000000;
set_sweep_frequency(ST_START, (uint32_t) 0);
set_sweep_frequency(ST_STOP, (uint32_t) 350000000);
setting.attenuate = 30.0;
@ -132,7 +132,7 @@ void reset_settings(int m)
case M_GENLOW:
setting.drive=8;
minFreq = 0;
maxFreq = 520000000;
maxFreq = 350000000;
set_sweep_frequency(ST_CENTER, 10000000);
set_sweep_frequency(ST_SPAN, 0);
setting.sweep_time_us = 10*ONE_SECOND_TIME;
@ -895,9 +895,9 @@ pureRSSI_t get_frequency_correction(uint32_t f) // Frequency dependent RSSI
while (f > config.correction_frequency[i] && i < CORRECTION_POINTS)
i++;
if (i >= CORRECTION_POINTS)
return(config.correction_value[CORRECTION_POINTS-1]);
return(scaled_correction_value[CORRECTION_POINTS-1] >> (SCALE_FACTOR - 5) );
if (i == 0)
return(config.correction_value[0]);
return(scaled_correction_value[0] >> (SCALE_FACTOR - 5) );
f = f - config.correction_frequency[i-1];
#if 0
uint32_t m = (config.correction_frequency[i] - config.correction_frequency[i-1]) >> SCALE_FACTOR ;
@ -2725,7 +2725,7 @@ int validate_signal_within(int i, float margin)
return TS_CRITICAL;
}
test_fail_cause[i] = "Frequency ";
if (peakFreq < test_case[i].center * 1000000 - 200000 || test_case[i].center * 1000000 + 200000 < peakFreq )
if (peakFreq < test_case[i].center * 1000000 - 600000 || test_case[i].center * 1000000 + 600000 < peakFreq )
return TS_FAIL;
test_fail_cause[i] = "";
return TS_PASS;

@ -1263,7 +1263,7 @@ static const menuitem_t menu_atten[] = {
{ MT_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_cb},
{ MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL", "0..30"},
{ MT_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "\n0225..40dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "22.5dB..\n40dB", menu_atten_high_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1428,9 +1428,9 @@ static const menuitem_t menu_measure[] = {
{ MT_CALLBACK, M_IMD, "HARMONIC", menu_measure_cb},
{ MT_CALLBACK, M_OIP3, "OIP3", menu_measure_cb},
{ MT_CALLBACK, M_PHASE_NOISE,"PHASE\nNOISE", menu_measure_cb},
{ MT_CALLBACK, M_STOP_BAND, "STOP\nBAND", menu_measure_cb},
{ MT_CALLBACK, M_PASS_BAND, "PASS\nBAND", menu_measure_cb},
{ MT_CALLBACK | MT_LOW, M_LINEARITY, "LINEAR", menu_measure_cb},
// { MT_CALLBACK, M_STOP_BAND, "STOP\nBAND", menu_measure_cb},
// { MT_CALLBACK, M_PASS_BAND, "PASS\nBAND", menu_measure_cb},
// { MT_CALLBACK | MT_LOW, M_LINEARITY, "LINEAR", menu_measure_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1501,7 +1501,7 @@ static const menuitem_t menu_level[] = {
{ MT_SUBMENU, 0, "ATTEN", menu_atten},
{ MT_SUBMENU,0, "CALC", menu_average},
{ MT_SUBMENU, 0, "UNIT", menu_unit},
{ MT_KEYPAD, KM_OFFSET, "EXTERN\nAMP",NULL},
{ MT_KEYPAD, KM_OFFSET, "EXTERNAL\nAMP",NULL},
{ MT_SUBMENU, 0, "TRIGGER", menu_trigger},
{ MT_CANCEL, 0, "\032 BACK",NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel

Loading…
Cancel
Save

Powered by TurnKey Linux.