From 62e5ec1dbb3b942b2d910c5c18c5d507e807b958 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 10 Jan 2016 10:45:22 -0800 Subject: [PATCH] Postpone clearing channel_spectrum_request_update until finished with data in array. There was potential for new samples to be copied into array as the FFT and post-processing were occuring. --- firmware/baseband/spectrum_collector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/baseband/spectrum_collector.cpp b/firmware/baseband/spectrum_collector.cpp index 7a70b69e..16162272 100644 --- a/firmware/baseband/spectrum_collector.cpp +++ b/firmware/baseband/spectrum_collector.cpp @@ -81,7 +81,6 @@ void SpectrumCollector::update() { // Called from idle thread (after EVT_MASK_SPECTRUM is flagged) if( streaming && channel_spectrum_request_update ) { /* Decimated buffer is full. Compute spectrum. */ - channel_spectrum_request_update = false; fft_c_preswapped(channel_spectrum); ChannelSpectrum spectrum; @@ -100,4 +99,6 @@ void SpectrumCollector::update() { } fifo.in(spectrum); } + + channel_spectrum_request_update = false; }