From a42d1fe49e0d17ce4584c7d36b35a2d20a852130 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Thu, 12 Nov 2026 10:32:18 +0100 Subject: [PATCH] Zero span: drop RSSI samples left in the buffer at a new setup The zero span fill measures sweep_points RSSI samples and the following reads return them until the buffer is used up. A reader that stopped early, such as scanraw with fewer points than the sweep or an aborted sweep, left samples of its frequency and RBW behind, and the next scanraw or sweep returned them for its first points (a 29-31 MHz scanraw after a 290 point zero span scanraw showed the noise of a 600 kHz RBW at 30 MHz). The first point after a change of settings or frequency step now clears them. --- sa_core.c | 10 ++++++++++ si4432.c | 5 +++++ si4432.h | 2 ++ si4468.c | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/sa_core.c b/sa_core.c index f6b5827..1db339a 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3765,6 +3765,16 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / update_rbw(); calculate_step_delay(); scandirty = true; // This is the first pass with new settings +#ifdef __FAST_SWEEP__ + // A zero span reader that stopped early (scanraw with fewer points, an abort) left RSSI + // samples of its own frequency and RBW in the buffer, the next reads would return them +#ifdef __SI4432__ + SI4432_Fill_clear(); +#endif +#ifdef __SI4463__ + SI446x_Fill_clear(); +#endif +#endif // Set for actual time pre calculated value (update after sweep) setting.actual_sweep_time_us = calc_min_sweep_time_us(); // Change actual sweep time as user input if it greater minimum diff --git a/si4432.c b/si4432.c index 2661a02..56e568d 100644 --- a/si4432.c +++ b/si4432.c @@ -709,6 +709,11 @@ void SI4432_Fill(int s, int start) buf_end = sweep_points - 1; buf_read = true; } + +void SI4432_Fill_clear(void) // drop the samples a zero span reader did not use +{ + buf_read = false; +} #endif #ifdef __LISTEN__ diff --git a/si4432.h b/si4432.h index 5105ca9..deeebce 100644 --- a/si4432.h +++ b/si4432.h @@ -140,6 +140,7 @@ uint16_t set_rbw(uint16_t WISH); void set_calibration_freq(int freq); #ifdef __FAST_SWEEP__ void SI4432_Fill(int s, int start); +void SI4432_Fill_clear(void); void SI4432_trigger_fill(int s, uint8_t trigger_lvl, int up_direction, int trigger_mode); #if 0 int SI4432_is_fast_mode(void); @@ -194,6 +195,7 @@ extern si446x_info_t SI4463_info; pureRSSI_t getSI4463_RSSI_correction(void); void Si446x_getInfo(si446x_info_t* info); void SI446x_Fill(int s, int start); +void SI446x_Fill_clear(void); void SI446x_trigger_fill(int s, uint8_t trigger_lvl, int up_direction, int trigger_mode); void SI4463_init(void); void set_calibration_freq(int freq); diff --git a/si4468.c b/si4468.c index 8a8335c..3198f95 100644 --- a/si4468.c +++ b/si4468.c @@ -2205,6 +2205,11 @@ void SI446x_Fill(int s, int start) buf_end = sweep_points - 1; buf_read = true; } + +void SI446x_Fill_clear(void) // drop the samples a zero span reader did not use +{ + buf_read = false; +} #endif #ifdef __LISTEN__