From 4f060c00477ce4284da233082b30f88b7cdf00d1 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 31 May 2020 21:50:06 +0200 Subject: [PATCH 1/2] Esnure frame size is 84 samples, correctly report space as number of frames --- FM.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/FM.cpp b/FM.cpp index 4f6b93f..8449e23 100644 --- a/FM.cpp +++ b/FM.cpp @@ -20,9 +20,11 @@ #include "Globals.h" #include "FM.h" + const uint16_t FM_TX_BLOCK_SIZE = 100U; -const uint16_t FM_SERIAL_BLOCK_SIZE = 42U;//this is actually the number of sample pairs to send over serial. One sample pair is 3bytes. - //three times this value shall never exceed 126 ! +const uint16_t FM_SERIAL_BLOCK_SIZE = 84U;//this is the number of sample pairs to send over serial. One sample pair is 3bytes. + //three times this value shall never exceed 252 +const uint16_t FM_SERIAL_BLOCK_SIZE_BYTES = FM_SERIAL_BLOCK_SIZE * 3U; CFM::CFM() : m_callsign(), @@ -721,8 +723,8 @@ void CFM::beginRelaying() uint8_t CFM::getSpace() const { - // The amount of free space for receiving external audio, in bytes. - return m_inputExtRB.getSpace(); + // The amount of free space for receiving external audio, in frames. + return m_inputExtRB.getSpace() / FM_SERIAL_BLOCK_SIZE_BYTES; } uint8_t CFM::writeData(const uint8_t* data, uint8_t length) From 2a4b28c35e225c26ddedaf5cff0f90aa21b6819f Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 31 May 2020 21:50:39 +0200 Subject: [PATCH 2/2] return space as number of bytes --- FMUpSampler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FMUpSampler.cpp b/FMUpSampler.cpp index 04fe705..80cba37 100644 --- a/FMUpSampler.cpp +++ b/FMUpSampler.cpp @@ -92,5 +92,6 @@ bool CFMUpSampler::getSample(q15_t& sample) uint16_t CFMUpSampler::getSpace() const { - return m_samples.getSpace(); + //return available space in bytes + return m_samples.getSpace() * sizeof(TSamplePairPack); } \ No newline at end of file