|
|
|
|
@ -1245,37 +1245,39 @@ VNA_SHELL_FUNCTION(cmd_scanraw)
|
|
|
|
|
float f_step = (stop-start)/ points;
|
|
|
|
|
setting.frequency_step = (freq_t)f_step;
|
|
|
|
|
|
|
|
|
|
streamPut(shell_stream, '{');
|
|
|
|
|
static freq_t old_start=0, old_stop=0;
|
|
|
|
|
static uint32_t old_points=0;
|
|
|
|
|
if (old_start != start || old_stop != stop || old_points != points) { // To prevent dirty for every sweep
|
|
|
|
|
dirty = true;
|
|
|
|
|
old_start = start;
|
|
|
|
|
old_stop = stop;
|
|
|
|
|
old_points = points;
|
|
|
|
|
}
|
|
|
|
|
operation_requested = false;
|
|
|
|
|
dirty = true;
|
|
|
|
|
|
|
|
|
|
// adc_stop_analog_watchdog();
|
|
|
|
|
int oldpos = 0;
|
|
|
|
|
ili9341_set_background(LCD_BG_COLOR);
|
|
|
|
|
ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1);
|
|
|
|
|
ili9341_set_background(LCD_SWEEP_LINE_COLOR);
|
|
|
|
|
#define BUFFER_SIZE 64
|
|
|
|
|
uint8_t buf[BUFFER_SIZE];
|
|
|
|
|
int idx = 0;
|
|
|
|
|
buf[idx++] = '{';
|
|
|
|
|
for (uint32_t i = 0; i < points; i++) {
|
|
|
|
|
int val = perform(false, i, start +(freq_t)(f_step * i), false) + float_TO_PURE_RSSI(config.ext_zero_level);
|
|
|
|
|
if (operation_requested || SDU1.config->usbp->state != USB_ACTIVE) // break on operation in perform
|
|
|
|
|
break;
|
|
|
|
|
streamPut(shell_stream, 'x');
|
|
|
|
|
streamPut(shell_stream, (uint8_t)(val & 0xFF));
|
|
|
|
|
streamPut(shell_stream, (uint8_t)((val>>8) & 0xFF));
|
|
|
|
|
if ((i & 0x07) == 0) { // if required
|
|
|
|
|
buf[idx++] = 'x';
|
|
|
|
|
buf[idx++] = (uint8_t)(val & 0xFF);
|
|
|
|
|
buf[idx++] = (uint8_t)((val>>8) & 0xFF);
|
|
|
|
|
if (idx >= BUFFER_SIZE - 4) {
|
|
|
|
|
streamWrite(shell_stream, buf, idx);
|
|
|
|
|
idx = 0;
|
|
|
|
|
}
|
|
|
|
|
int pos = i * (WIDTH+1) / points;
|
|
|
|
|
ili9341_set_background(LCD_SWEEP_LINE_COLOR);
|
|
|
|
|
ili9341_fill(OFFSETX, CHART_BOTTOM+1, pos, 1); // update sweep progress bar
|
|
|
|
|
ili9341_set_background(LCD_BG_COLOR);
|
|
|
|
|
ili9341_fill(OFFSETX+pos, CHART_BOTTOM+1, WIDTH-pos, 1);
|
|
|
|
|
if (pos - oldpos > 8) {
|
|
|
|
|
ili9341_fill(OFFSETX + oldpos, CHART_BOTTOM+1, pos - oldpos, 1); // update sweep progress bar
|
|
|
|
|
oldpos = pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
buf[idx++] = '}';
|
|
|
|
|
streamWrite(shell_stream, buf, idx);
|
|
|
|
|
// adc_start_analog_watchdog();
|
|
|
|
|
ili9341_set_background(LCD_BG_COLOR);
|
|
|
|
|
ili9341_fill(OFFSETX, CHART_BOTTOM+1, WIDTH, 1);
|
|
|
|
|
streamPut(shell_stream, '}');
|
|
|
|
|
setting.frequency_step = old_step;
|
|
|
|
|
dirty = true;
|
|
|
|
|
redraw_request = 0; // disable screen update in this mode
|
|
|
|
|
|