Updated scan command

pull/4/head
erikkaashoek 6 years ago
parent b6d7de9e4f
commit b17c8afdf2

@ -964,7 +964,7 @@ bool sweep(bool break_on_operation)
VNA_SHELL_FUNCTION(cmd_scan) VNA_SHELL_FUNCTION(cmd_scan)
{ {
uint32_t start, stop; uint32_t start, stop;
int16_t points = sweep_points; uint32_t points = sweep_points;
int i; int i;
if (argc < 2 || argc > 4) { if (argc < 2 || argc > 4) {
shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n"); shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n");
@ -979,10 +979,31 @@ VNA_SHELL_FUNCTION(cmd_scan)
} }
if (argc >= 3) { if (argc >= 3) {
points = my_atoi(argv[2]); points = my_atoi(argv[2]);
if (points <= 0 || points > POINTS_COUNT) { // if (points <= 0 || points > POINTS_COUNT) {
shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n"); // shell_printf("sweep points exceeds range "define_to_STR(POINTS_COUNT)"\r\n");
return; // 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<points; i++) {
if (operation_requested)
break;
float val = perform(false, i, start +(int32_t)(f_step * i), false);
streamPut(shell_stream, 'x');
int v = val*2 + 256;
streamPut(shell_stream, (uint8_t)(v & 0xFF));
streamPut(shell_stream, (uint8_t)((v>>8) & 0xFF));
// enable led
} }
streamPut(shell_stream, '}');
setting.frequency_step = old_step;
return;
} }
set_frequencies(start, stop, points); set_frequencies(start, stop, points);

Loading…
Cancel
Save

Powered by TurnKey Linux.