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)
{
uint32_t start, stop;
int16_t points = sweep_points;
uint32_t points = sweep_points;
int i;
if (argc < 2 || argc > 4) {
shell_printf("usage: scan {start(Hz)} {stop(Hz)} [points] [outmask]\r\n");
@ -979,11 +979,32 @@ 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");
// 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<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);
#ifdef __VNA__

Loading…
Cancel
Save

Powered by TurnKey Linux.