From 0ebfbcccefc5cfa21235cf2467813029d0729cbd Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 8 Sep 2026 01:49:30 +0100 Subject: [PATCH] Fix stale spectrum bins on skipped sub-GHz frequencies In the all-bands sweep the CC1101 band gaps are skipped, but their bins kept whatever a previous pass left there, drawing phantom bars. Set skipped bins to the -127 dBm floor. --- subghz_scan/subghz_scan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/subghz_scan/subghz_scan.c b/subghz_scan/subghz_scan.c index cab1bfc..b54362b 100644 --- a/subghz_scan/subghz_scan.c +++ b/subghz_scan/subghz_scan.c @@ -89,7 +89,14 @@ static int32_t scan_thread(void* ctx) { float peak = -127.0f; for(int i = 0; i < nb && app->active; i++) { uint32_t f = rs + (uint32_t)i * step; - if(!furi_hal_subghz_is_frequency_valid(f)) continue; + if(!furi_hal_subghz_is_frequency_valid(f)) { + // Band gaps (e.g. in the all-bands sweep): report a floor, not a + // stale reading left in the bin from a previous pass. + furi_mutex_acquire(app->mutex, FuriWaitForever); + app->m.bins[i] = -127.0f; + furi_mutex_release(app->mutex); + continue; + } furi_hal_subghz_idle(); furi_hal_subghz_set_frequency_and_path(f); furi_hal_subghz_flush_rx();