Remove the delay when using COS.

This commit is contained in:
Jonathan Naylor 2020-05-10 17:13:10 +01:00
parent da16ee277c
commit 3ad443dc2a
5 changed files with 12 additions and 15 deletions

6
FM.cpp
View File

@ -78,9 +78,11 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
q15_t currentRFSample = q15_t((q31_t(samples[i]) << 8) / m_rxLevel); q15_t currentRFSample = q15_t((q31_t(samples[i]) << 8) / m_rxLevel);
uint8_t ctcssState = m_ctcssRX.process(currentRFSample); uint8_t ctcssState = m_ctcssRX.process(currentRFSample);
if (!m_useCOS) {
// Delay the audio by 100ms to better match the CTCSS detector output // Delay the audio by 100ms to better match the CTCSS detector output
m_inputRFRB.put(currentRFSample); m_inputRFRB.put(currentRFSample);
m_inputRFRB.get(currentRFSample); m_inputRFRB.get(currentRFSample);
}
q15_t currentExtSample; q15_t currentExtSample;
bool inputExt = m_inputExtRB.get(currentExtSample);//always consume the external input data so it does not overflow bool inputExt = m_inputExtRB.get(currentExtSample);//always consume the external input data so it does not overflow
@ -153,10 +155,9 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
void CFM::process() void CFM::process()
{ {
q15_t sample; q15_t sample;
while(io.getSpace() >= 3U && m_outputRFRB.get(sample)) { while(io.getSpace() >= 3U && m_outputRFRB.get(sample))
io.write(STATE_FM, &sample, 1U); io.write(STATE_FM, &sample, 1U);
} }
}
void CFM::reset() void CFM::reset()
{ {
@ -704,4 +705,3 @@ void CFM::insertSilence(uint16_t ms)
for (uint32_t i = 0U; i < nSamples; i++) for (uint32_t i = 0U; i < nSamples; i++)
m_outputRFRB.put(0); m_outputRFRB.put(0);
} }

View File

@ -82,7 +82,7 @@ void CNXDNTX::process()
m_poBuffer[m_poLen++] = NXDN_PREAMBLE[2U]; m_poBuffer[m_poLen++] = NXDN_PREAMBLE[2U];
} else { } else {
for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++) { for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++) {
uint8_t c; uint8_t c = 0U;
m_buffer.get(c); m_buffer.get(c);
m_poBuffer[m_poLen++] = c; m_poBuffer[m_poLen++] = c;
} }
@ -168,4 +168,3 @@ uint8_t CNXDNTX::getSpace() const
{ {
return m_buffer.getSpace() / NXDN_FRAME_LENGTH_BYTES; return m_buffer.getSpace() / NXDN_FRAME_LENGTH_BYTES;
} }

View File

@ -79,7 +79,7 @@ void CP25TX::process()
uint8_t length; uint8_t length;
m_buffer.get(length); m_buffer.get(length);
for (uint8_t i = 0U; i < length; i++) { for (uint8_t i = 0U; i < length; i++) {
uint8_t c; uint8_t c = 0U;
m_buffer.get(c); m_buffer.get(c);
m_poBuffer[m_poLen++] = c; m_poBuffer[m_poLen++] = c;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX * Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -61,7 +61,7 @@ void CPOCSAGTX::process()
m_poBuffer[m_poLen++] = POCSAG_SYNC; m_poBuffer[m_poLen++] = POCSAG_SYNC;
} else { } else {
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) { for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
uint8_t c; uint8_t c = 0U;
m_buffer.get(c); m_buffer.get(c);
m_poBuffer[m_poLen++] = c; m_poBuffer[m_poLen++] = c;
} }
@ -147,4 +147,3 @@ uint8_t CPOCSAGTX::getSpace() const
{ {
return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES; return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX * Copyright (C) 2009-2018,2020 by Jonathan Naylor G4KLX
* Copyright (C) 2017 by Andy Uribe CA6JAU * Copyright (C) 2017 by Andy Uribe CA6JAU
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -76,7 +76,7 @@ void CYSFTX::process()
m_poBuffer[m_poLen++] = YSF_START_SYNC; m_poBuffer[m_poLen++] = YSF_START_SYNC;
} else { } else {
for (uint8_t i = 0U; i < YSF_FRAME_LENGTH_BYTES; i++) { for (uint8_t i = 0U; i < YSF_FRAME_LENGTH_BYTES; i++) {
uint8_t c; uint8_t c = 0U;
m_buffer.get(c); m_buffer.get(c);
m_poBuffer[m_poLen++] = c; m_poBuffer[m_poLen++] = c;
} }
@ -192,4 +192,3 @@ void CYSFTX::setParams(bool on, uint8_t txHang)
m_loDev = on; m_loDev = on;
m_txHang = txHang * 1200U; m_txHang = txHang * 1200U;
} }