diff --git a/main.c b/main.c index ddbd41c..cae46ce 100644 --- a/main.c +++ b/main.c @@ -965,7 +965,7 @@ VNA_SHELL_FUNCTION(cmd_scan) { uint32_t start, stop; uint32_t points = sweep_points; - int i; + uint32_t i; if (argc < 2 || argc > 4) { shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n"); return; @@ -979,33 +979,11 @@ VNA_SHELL_FUNCTION(cmd_scan) } if (argc >= 3) { points = my_atoi(argv[2]); - // if (points <= 0 || points > POINTS_COUNT) { - // shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n"); - // return; - // } - } - - if (argc==4 && my_atoui(argv[3]) == 16) { - int old_step = setting.frequency_step; - float f_step = (stop-start)/ points; - setting.frequency_step = (int32_t)f_step; - streamPut(shell_stream, '{'); - dirty = true; - for (int i = 0; i>8) & 0xFF)); - // enable led + if (points <= 0 || points > POINTS_COUNT) { + shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n"); + return; } - streamPut(shell_stream, '}'); - setting.frequency_step = old_step; - return; } - set_frequencies(start, stop, points); #ifdef __VNA__ if (cal_auto_interpolate && (cal_status & CALSTAT_APPLY)) @@ -2284,6 +2262,7 @@ static const VNAShellCommand commands[] = #endif // {"gamma" , cmd_gamma , 0}, {"scan" , cmd_scan , CMD_WAIT_MUTEX}, + {"scanraw" , cmd_scanraw , CMD_WAIT_MUTEX}, {"sweep" , cmd_sweep , 0}, {"test" , cmd_test , 0}, {"touchcal" , cmd_touchcal , CMD_WAIT_MUTEX}, diff --git a/sa_cmd.c b/sa_cmd.c index 88f43a9..af50c4f 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -464,3 +464,41 @@ VNA_SHELL_FUNCTION(cmd_correction) config.correction_value[i] = v; shell_printf("updated %d to %d %.1f\r\n", i, config.correction_frequency[i], config.correction_value[i]); } + +VNA_SHELL_FUNCTION(cmd_scanraw) +{ + uint32_t start, stop; + uint32_t points = sweep_points; + if (argc < 2 || argc > 3) { + shell_printf("usage: scanraw {start(Hz)} {stop(Hz)} [points]\r\n"); + return; + } + + start = my_atoui(argv[0]); + stop = my_atoui(argv[1]); + if (start > stop) { + shell_printf("frequency range is invalid\r\n"); + return; + } + if (argc == 3) { + points = my_atoi(argv[2]); + } + int old_step = setting.frequency_step; + float f_step = (stop-start)/ points; + setting.frequency_step = (int32_t)f_step; + streamPut(shell_stream, '{'); + dirty = true; + for (uint32_t i = 0; i>8) & 0xFF)); + } + streamPut(shell_stream, '}'); + setting.frequency_step = old_step; +} + +