Calculate correct CW sweep time when spur is on

pull/4/head
erikkaashoek 6 years ago
parent 7d259443ab
commit 63e8cee471

@ -156,8 +156,12 @@ static THD_FUNCTION(Thread1, arg)
shell_function(shell_nargs - 1, &shell_args[1]); shell_function(shell_nargs - 1, &shell_args[1]);
shell_function = 0; shell_function = 0;
osalThreadSleepMilliseconds(10); osalThreadSleepMilliseconds(10);
if (dirty && MODE_OUTPUT(setting.mode)) if (dirty) {
draw_menu(); // update screen if in output mode and dirty if (MODE_OUTPUT(setting.mode))
draw_menu(); // update screen if in output mode and dirty
else
redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA | REDRAW_FREQUENCY;
}
continue; continue;
} }
// Process UI inputs // Process UI inputs
@ -2438,9 +2442,12 @@ static void VNAShell_executeLine(char *line)
} while (shell_function); } while (shell_function);
} else { } else {
scp->sc_function(shell_nargs - 1, &shell_args[1]); scp->sc_function(shell_nargs - 1, &shell_args[1]);
if (dirty && MODE_OUTPUT(setting.mode)) { if (dirty) {
operation_requested = true; // ensure output is updated operation_requested = true; // ensure output is updated
draw_menu(); if (MODE_OUTPUT(setting.mode))
draw_menu(); // update screen if in output mode and dirty
else
redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA | REDRAW_FREQUENCY;
} }
} }
return; return;

@ -195,7 +195,7 @@ void set_sweep_time(float);
//extern int setting.rbw; //extern int setting.rbw;
#ifdef __SPUR__ #ifdef __SPUR__
//extern int setting.spur; //extern int setting.spur;
void SetSpur(int v); void set_spur(int v);
#endif #endif
void set_average(int); void set_average(int);
int GetAverage(void); int GetAverage(void);

@ -2154,7 +2154,11 @@ draw_frequencies(void)
#endif #endif
if (FREQ_IS_CW()) { if (FREQ_IS_CW()) {
plot_printf(buf1, sizeof(buf1), " CW %qHz", get_sweep_frequency(ST_CW)); plot_printf(buf1, sizeof(buf1), " CW %qHz", get_sweep_frequency(ST_CW));
float t = setting.actual_sweep_time; // in mS
float t = calc_min_sweep_time(); // Calc minimum sweep time
if (t < setting.sweep_time)
t = setting.sweep_time;
setting.actual_sweep_time = t;
; // in mS ; // in mS
if (t>=1000) if (t>=1000)
plot_printf(buf2, sizeof(buf2), " TIME %.2fS",t/1000.0); plot_printf(buf2, sizeof(buf2), " TIME %.2fS",t/1000.0);

@ -80,11 +80,12 @@ VNA_SHELL_FUNCTION(cmd_spur)
return; return;
} }
if (strcmp(argv[0],"on") == 0) { if (strcmp(argv[0],"on") == 0) {
setting.spur = 1; set_spur(1);
} else if (strcmp(argv[0],"off") == 0) { } else if (strcmp(argv[0],"off") == 0) {
setting.spur = 0; set_spur(0);
} else } else
goto usage; goto usage;
redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA;
} }
VNA_SHELL_FUNCTION(cmd_output) VNA_SHELL_FUNCTION(cmd_output)
@ -133,6 +134,7 @@ VNA_SHELL_FUNCTION(cmd_attenuate)
// goto usage; // goto usage;
set_attenuation(a); set_attenuation(a);
} }
redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA;
} }
VNA_SHELL_FUNCTION(cmd_level) VNA_SHELL_FUNCTION(cmd_level)
@ -234,7 +236,7 @@ VNA_SHELL_FUNCTION(cmd_trigger)
float t = my_atof(argv[0]); float t = my_atof(argv[0]);
if (setting.trigger == T_AUTO ) if (setting.trigger == T_AUTO )
set_trigger(T_NORMAL); set_trigger(T_NORMAL);
set_trigger_level(t); set_trigger_level(to_dBm(t));
goto update; goto update;
} }
static const char cmd_trigger_list[] = "auto|normal|single"; static const char cmd_trigger_list[] = "auto|normal|single";

@ -38,6 +38,7 @@ int const reffer_freq[] = {30000000, 15000000, 10000000, 4000000, 3000000, 20000
int in_selftest = false; int in_selftest = false;
#if 0
const char *dummy = "this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ const char *dummy = "this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\
this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\
this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\
@ -50,10 +51,11 @@ this is a very long string only used to fill memory so I know when the memory is
this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\ this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available\
this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available" this is a very long string only used to fill memory so I know when the memory is full and I can remove some of this string to make more memory available"
; ;
#endif
void reset_settings(int m) void reset_settings(int m)
{ {
strcpy((char *)spi_buffer, dummy); // strcpy((char *)spi_buffer, dummy);
setting.mode = m; setting.mode = m;
setting.unit_scale_index = 0; setting.unit_scale_index = 0;
setting.unit_scale = 1; setting.unit_scale = 1;
@ -164,7 +166,7 @@ float calc_min_sweep_time(void) // Calculate minimum sweep time in mS
else { else {
if (FREQ_IS_CW()) { if (FREQ_IS_CW()) {
a = (float)MINIMUM_SWEEP_TIME / 290.0; // time per step in CW mode a = (float)MINIMUM_SWEEP_TIME / 290.0; // time per step in CW mode
if (setting.repeat != 1 || setting.sweep_time >= 1000) if (setting.repeat != 1 || setting.sweep_time >= 1000 || setting.spur != 0)
a = 15.0 / 290.0; // time per step in CW mode with repeat a = 15.0 / 290.0; // time per step in CW mode with repeat
} }
t = vbwSteps * sweep_points * (setting.spur ? 2 : 1) * ( (a + (setting.repeat - 1)* REPEAT_TIME/1000.0)); t = vbwSteps * sweep_points * (setting.spur ? 2 : 1) * ( (a + (setting.repeat - 1)* REPEAT_TIME/1000.0));
@ -1360,7 +1362,7 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking)
skip_LO_setting: skip_LO_setting:
#ifdef __FAST_SWEEP__ #ifdef __FAST_SWEEP__
if (i == 0 && setting.frequency_step == 0 && setting.trigger == T_AUTO && actualStepDelay == 0 && setting.repeat == 1 && setting.sweep_time < 1000) { if (i == 0 && setting.frequency_step == 0 && setting.trigger == T_AUTO && setting.spur == 0 && actualStepDelay == 0 && setting.repeat == 1 && setting.sweep_time < 1000) {
SI4432_Fill(MODE_SELECT(setting.mode), 0); SI4432_Fill(MODE_SELECT(setting.mode), 0);
} }
#endif #endif
@ -1397,7 +1399,7 @@ float perform(bool break_on_operation, int i, uint32_t f, int tracking)
if (subRSSI < setting.trigger_level) if (subRSSI < setting.trigger_level)
goto wait; goto wait;
#ifdef __FAST_SWEEP__ #ifdef __FAST_SWEEP__
if (i == 0 && setting.frequency_step == 0 /* && setting.trigger == T_AUTO */ && old_actual_step_delay == 0 && setting.repeat == 1 && setting.sweep_time < 1000) { if (i == 0 && setting.frequency_step == 0 /* && setting.trigger == T_AUTO */&& setting.spur == 0 && old_actual_step_delay == 0 && setting.repeat == 1 && setting.sweep_time < 1000) {
SI4432_Fill(MODE_SELECT(setting.mode), 1); SI4432_Fill(MODE_SELECT(setting.mode), 1);
} }
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.