From e6adc0a2961e45272fc6529f00cd7e1cb5da1972 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 2 Aug 2017 20:38:46 +0100 Subject: [PATCH] Forgot the Q31 to Q15 conversion. --- DStarRX.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DStarRX.cpp b/DStarRX.cpp index 962f958..79721cd 100644 --- a/DStarRX.cpp +++ b/DStarRX.cpp @@ -304,11 +304,13 @@ void CDStarRX::samples(q15_t* samples, const uint16_t* rssi, uint8_t length) dcLevel += dcVals[i]; dcLevel /= length; + q15_t offset = q15_t(__SSAT((dcLevel >> 16), 16)); + for (uint16_t i = 0U; i < length; i++) { m_rssiAccum += rssi[i]; m_rssiCount++; - q15_t sample = samples[i] - dcLevel; + q15_t sample = samples[i] - offset; m_bitBuffer[m_bitPtr] <<= 1; if (sample < 0)