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
This commit is contained in:
DiSlord 2020-03-14 16:05:26 +03:00
parent ec81a01226
commit 8a11eaa764

22
main.c
View file

@ -841,9 +841,9 @@ VNA_SHELL_FUNCTION(cmd_scan)
{ {
uint32_t start, stop; uint32_t start, stop;
int16_t points = sweep_points; int16_t points = sweep_points;
int i;
if (argc != 2 && argc != 3) { if (argc < 2 || argc > 4) {
shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points]\r\n"); shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n");
return; return;
} }
@ -866,6 +866,20 @@ VNA_SHELL_FUNCTION(cmd_scan)
cal_interpolate(lastsaveid); cal_interpolate(lastsaveid);
pause_sweep(); pause_sweep();
sweep(false); 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 static void
@ -1719,7 +1733,7 @@ VNA_SHELL_FUNCTION(cmd_frequencies)
(void)argv; (void)argv;
for (i = 0; i < sweep_points; i++) { for (i = 0; i < sweep_points; i++) {
if (frequencies[i] != 0) if (frequencies[i] != 0)
shell_printf("%d\r\n", frequencies[i]); shell_printf("%u\r\n", frequencies[i]);
} }
} }