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.
This commit is contained in:
@@ -89,7 +89,14 @@ static int32_t scan_thread(void* ctx) {
|
|||||||
float peak = -127.0f;
|
float peak = -127.0f;
|
||||||
for(int i = 0; i < nb && app->active; i++) {
|
for(int i = 0; i < nb && app->active; i++) {
|
||||||
uint32_t f = rs + (uint32_t)i * step;
|
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_idle();
|
||||||
furi_hal_subghz_set_frequency_and_path(f);
|
furi_hal_subghz_set_frequency_and_path(f);
|
||||||
furi_hal_subghz_flush_rx();
|
furi_hal_subghz_flush_rx();
|
||||||
|
|||||||
Reference in New Issue
Block a user