sweep once and sd functions changed

SI443_RBW_update
erikkaashoek 4 years ago
parent c752c85dc8
commit c87c246496

@ -79,8 +79,10 @@ static volatile vna_shellcmd_t shell_function = 0;
void update_frequencies(void); void update_frequencies(void);
static void set_frequencies(freq_t start, freq_t stop, uint16_t points); static void set_frequencies(freq_t start, freq_t stop, uint16_t points);
static bool sweep(bool break_on_operation); static bool sweep(bool break_on_operation);
static long_t my_atoi(const char *p);
uint8_t sweep_mode = SWEEP_ENABLE; uint8_t sweep_mode = SWEEP_ENABLE;
uint16_t sweep_once_count = 1;
uint16_t redraw_request = 0; // contains REDRAW_XXX flags uint16_t redraw_request = 0; // contains REDRAW_XXX flags
// Version text, displayed in Config->Version menu, also send by info command // Version text, displayed in Config->Version menu, also send by info command
const char *info_about[]={ const char *info_about[]={
@ -157,7 +159,10 @@ static THD_FUNCTION(Thread1, arg)
*t++ = *f++; *t++ = *f++;
completed = sweep(true); completed = sweep(true);
sweep_mode&=~SWEEP_ONCE; if (sweep_once_count>1) {
sweep_once_count--;
} else
sweep_mode&=~SWEEP_ONCE;
} else if (sweep_mode & SWEEP_SELFTEST) { } else if (sweep_mode & SWEEP_SELFTEST) {
// call from lowest level to save stack space // call from lowest level to save stack space
self_test(setting.test); self_test(setting.test);
@ -245,7 +250,7 @@ void enableTracesAtComplete(uint8_t mask){
int int
is_paused(void) is_paused(void)
{ {
return !(sweep_mode & SWEEP_ENABLE); return !(sweep_mode & (SWEEP_ENABLE|SWEEP_ONCE));
} }
static inline void static inline void
@ -260,6 +265,13 @@ resume_sweep(void)
sweep_mode |= SWEEP_ENABLE; sweep_mode |= SWEEP_ENABLE;
} }
static inline void
resume_once(uint16_t c)
{
sweep_once_count = c;
sweep_mode |= SWEEP_ONCE;
}
void void
toggle_sweep(void) toggle_sweep(void)
{ {
@ -344,14 +356,28 @@ VNA_SHELL_FUNCTION(cmd_pause)
draw_cal_status(); draw_cal_status();
} }
VNA_SHELL_FUNCTION(cmd_resume) VNA_SHELL_FUNCTION(cmd_status)
{ {
(void)argc; (void)argc;
(void)argv; (void)argv;
if (is_paused())
shell_printf("Paused\r\n");
else
shell_printf("Resumed\r\n");
}
VNA_SHELL_FUNCTION(cmd_resume)
{
(void)argc;
(void)argv;
uint16_t c = 0;
// restore frequencies array and cal // restore frequencies array and cal
update_frequencies(); update_frequencies();
resume_sweep(); if (argc == 1) {
c = my_atoi(argv[0]);
resume_once(c) ;
} else
resume_sweep();
} }
VNA_SHELL_FUNCTION(cmd_reset) VNA_SHELL_FUNCTION(cmd_reset)
@ -827,6 +853,9 @@ VNA_SHELL_FUNCTION(cmd_sd_list)
VNA_SHELL_FUNCTION(cmd_sd_read) VNA_SHELL_FUNCTION(cmd_sd_read)
{ {
DIR dj;
FILINFO fno;
FRESULT res;
char *buf = (char *)spi_buffer; char *buf = (char *)spi_buffer;
if (argc != 1 || argv[0][0] == '?') if (argc != 1 || argv[0][0] == '?')
{ {
@ -837,14 +866,24 @@ VNA_SHELL_FUNCTION(cmd_sd_read)
if (cmd_sd_card_mount() != FR_OK) if (cmd_sd_card_mount() != FR_OK)
return; return;
if (f_open(fs_file, filename, FA_OPEN_EXISTING | FA_READ) != FR_OK){ res = f_findfirst(&dj, &fno, "", filename);
if (res != FR_OK || fno.fname[0] == 0)
goto error;
if (f_open(fs_file, fno.fname, FA_OPEN_EXISTING | FA_READ) != FR_OK){
error:
shell_printf("err: no file\r\n"); shell_printf("err: no file\r\n");
return; return;
} }
// shell_printf("sd_read: %s\r\n", filename); // shell_printf("sd_read: %s\r\n", filename);
// number of bytes to follow (file size) // number of bytes to follow (file size)
uint32_t filesize = f_size(fs_file); uint32_t filesize = f_size(fs_file);
#if 1
shell_printf("%u\r\n", filesize);
#else
streamWrite(shell_stream, (void *)&filesize, 4); streamWrite(shell_stream, (void *)&filesize, 4);
#endif
UINT size = 0; UINT size = 0;
// file data (send all data from file) // file data (send all data from file)
while (f_read(fs_file, buf, 512, &size) == FR_OK && size > 0) while (f_read(fs_file, buf, 512, &size) == FR_OK && size > 0)
@ -856,6 +895,8 @@ VNA_SHELL_FUNCTION(cmd_sd_read)
VNA_SHELL_FUNCTION(cmd_sd_delete) VNA_SHELL_FUNCTION(cmd_sd_delete)
{ {
DIR dj;
FILINFO fno;
FRESULT res; FRESULT res;
if (argc != 1 || argv[0][0] == '?') { if (argc != 1 || argv[0][0] == '?') {
usage_printf("sd_delete {filename}\r\n"); usage_printf("sd_delete {filename}\r\n");
@ -863,9 +904,14 @@ VNA_SHELL_FUNCTION(cmd_sd_delete)
} }
if (cmd_sd_card_mount() != FR_OK) if (cmd_sd_card_mount() != FR_OK)
return; return;
const char *filename = argv[0]; res = f_findfirst(&dj, &fno, "", argv[0]);
res = f_unlink(filename); while (res == FR_OK && fno.fname[0])
shell_printf("delete: %s %s\r\n", filename, res == FR_OK ? "OK" : "err"); {
res = f_unlink(fno.fname);
shell_printf("delete: %s %s\r\n", fno.fname, res == FR_OK ? "OK" : "err");
res = f_findnext(&dj, &fno);
}
return; return;
} }
#endif #endif
@ -1908,6 +1954,7 @@ static const VNAShellCommand commands[] =
{"touchtest" , cmd_touchtest , CMD_WAIT_MUTEX}, {"touchtest" , cmd_touchtest , CMD_WAIT_MUTEX},
{"pause" , cmd_pause , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD}, {"pause" , cmd_pause , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
{"resume" , cmd_resume , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD}, {"resume" , cmd_resume , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},
{"status" , cmd_status , CMD_RUN_IN_LOAD},
{"caloutput" , cmd_caloutput , CMD_RUN_IN_LOAD}, {"caloutput" , cmd_caloutput , CMD_RUN_IN_LOAD},
{"save" , cmd_save , CMD_RUN_IN_LOAD}, {"save" , cmd_save , CMD_RUN_IN_LOAD},
{"recall" , cmd_recall , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD}, {"recall" , cmd_recall , CMD_WAIT_MUTEX | CMD_RUN_IN_LOAD},

@ -3242,9 +3242,6 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
if (MODE_INPUT(setting.mode)){ // only cases where the value can change on 0 point of sweep if (MODE_INPUT(setting.mode)){ // only cases where the value can change on 0 point of sweep
if (setting.frequency_step != 0) { if (setting.frequency_step != 0) {
correct_RSSI_freq = get_frequency_correction(f); correct_RSSI_freq = get_frequency_correction(f);
#ifdef TINYSA4
// correct_RSSI_freq += float_TO_PURE_RSSI(direct ? -6.0 : 0); // TODO add impact of direct
#endif
} }
} }
// #define DEBUG_CORRECTION // #define DEBUG_CORRECTION
@ -3421,7 +3418,7 @@ again: // Spur redu
else else
{ {
#ifdef TINYSA4 #ifdef TINYSA4
if (actual_rbw_x10 < RBW_FOR_STATIC_TABLE ) if (actual_rbw_x10 < RBW_FOR_STATIC_TABLE && setting.mode == M_LOW )
local_IF = 977400000; // static spur table IF local_IF = 977400000; // static spur table IF
else else
local_IF = config.frequency_IF1; local_IF = config.frequency_IF1;

Loading…
Cancel
Save

Powered by TurnKey Linux.