From 8a11eaa76468d153ad0f375e77f3c445e23e599f Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sat, 14 Mar 2020 16:05:26 +0300 Subject: [PATCH] Extend scan command, now in have additional input variable (optional), allow more faster get measured data usage: scan {start(Hz)} {stop(Hz)} [points] [outmask] [outmask] - optional, allow output measured data, its a mask (allow dec, hex, bin, oct) 0b001 - output frequency 0b010 - output CH0 data 0b100 - output CH1 data Example: 'scan 1000000 5000000 101 0b111' - output data in format: freq ch0[0] ch0[1] ch1[0] ch1[1] 'scan 1000000 5000000 101 0b101' - output data in format: freq ch1[0] ch1[1] 'scan 1000000 5000000 101 0x7' - output data as 0b111 --- main.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 3748579..1335bfc 100644 --- a/main.c +++ b/main.c @@ -841,9 +841,9 @@ VNA_SHELL_FUNCTION(cmd_scan) { uint32_t start, stop; int16_t points = sweep_points; - - if (argc != 2 && argc != 3) { - shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points]\r\n"); + int i; + if (argc < 2 || argc > 4) { + shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n"); return; } @@ -866,6 +866,20 @@ VNA_SHELL_FUNCTION(cmd_scan) cal_interpolate(lastsaveid); pause_sweep(); sweep(false); + // Output data after if set (faster data recive) + if (argc == 4){ + uint16_t mask = my_atoui(argv[3]); + if (mask) + for (i = 0; i < points; i++){ + if (mask&1) + shell_printf("%u ", frequencies[i]); + if (mask&2) + shell_printf("%f %f ", measured[0][i][0], measured[0][i][1]); + if (mask&4) + shell_printf("%f %f ", measured[1][i][0], measured[1][i][1]); + shell_printf("\r\n"); + } + } } static void @@ -1719,7 +1733,7 @@ VNA_SHELL_FUNCTION(cmd_frequencies) (void)argv; for (i = 0; i < sweep_points; i++) { if (frequencies[i] != 0) - shell_printf("%d\r\n", frequencies[i]); + shell_printf("%u\r\n", frequencies[i]); } }