diff --git a/main.c b/main.c index d217bf7..e06860d 100644 --- a/main.c +++ b/main.c @@ -980,6 +980,14 @@ bool sweep(bool break_on_operation) } #endif +void set_sweep_points(uint16_t points){ + if (points == sweep_points || points > POINTS_COUNT) + return; + + sweep_points = points; + update_frequencies(); +} + VNA_SHELL_FUNCTION(cmd_scan) { uint32_t start, stop; @@ -2695,10 +2703,7 @@ int main(void) dacStart(&DACD2, &dac1cfg1); #endif setupSA(); - sweep_points = POINTS_COUNT; -/* initial frequencies */ - update_frequencies(); - + set_sweep_points(POINTS_COUNT); #ifdef __VNA__ /* diff --git a/nanovna.h b/nanovna.h index 9cb4150..281a0e1 100644 --- a/nanovna.h +++ b/nanovna.h @@ -123,6 +123,7 @@ enum stimulus_type { ST_START=0, ST_STOP, ST_CENTER, ST_SPAN, ST_CW }; +void set_sweep_points(uint16_t points); void update_frequencies(void); void set_sweep_frequency(int type, uint32_t frequency); uint32_t get_sweep_frequency(int type);