Write audio to serial port, blank to high audio, really ignore ext aduio when ext is disabled

This commit is contained in:
Geoffrey Merck 2020-05-10 21:59:14 +02:00
parent 3ad443dc2a
commit 36537c981c
1 changed files with 10 additions and 1 deletions

11
FM.cpp
View File

@ -86,6 +86,7 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
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
inputExt = inputExt && m_extEnabled;
if (!inputExt && (CTCSS_NOT_READY(ctcssState)) && m_modemState != STATE_FM) { if (!inputExt && (CTCSS_NOT_READY(ctcssState)) && m_modemState != STATE_FM) {
//Not enough samples to determine if you have CTCSS, just carry on. But only if we haven't any external data in the queue //Not enough samples to determine if you have CTCSS, just carry on. But only if we haven't any external data in the queue
@ -116,12 +117,15 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
currentBoost = m_extAudioBoost; currentBoost = m_extAudioBoost;
} }
// Only let RF audio through when relaying RF audio // Only let RF audio through when relaying RF audio
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) { if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
currentSample = m_blanking.process(currentSample);
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF)) if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
m_downsampler.addSample(currentSample); m_downsampler.addSample(currentSample);
currentSample = m_blanking.process(currentSample);
currentSample *= currentBoost; currentSample *= currentBoost;
} else { } else {
currentSample = 0; currentSample = 0;
@ -157,6 +161,11 @@ 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);
uint8_t serialSample;
//write data to serial port
while(m_downsampler.getPackedData(serialSample))
serial.writeFMData(&serialSample, 1U);
} }
void CFM::reset() void CFM::reset()