mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-04-05 14:37:02 +00:00
Merge remote-tracking branch 'upstream/FM' into FM_Ext
This commit is contained in:
commit
9afcf3acc9
4 changed files with 13 additions and 34 deletions
16
FM.cpp
16
FM.cpp
|
|
@ -41,15 +41,14 @@ m_hangTimer(),
|
|||
m_filterStage1( 724, 1448, 724, 32768, -37895, 21352),//3rd order Cheby Filter 300 to 2700Hz, 0.2dB passband ripple, sampling rate 24kHz
|
||||
m_filterStage2(32768, 0,-32768, 32768, -50339, 19052),
|
||||
m_filterStage3(32768, -65536, 32768, 32768, -64075, 31460),
|
||||
m_preemphasis(32768, 13967, 0, 32768, -18801, 0),//75µS 24kHz sampling rate
|
||||
m_deemphasis (32768, -18801, 0, 32768, 13967, 0),//75µS 24kHz sampling rate
|
||||
m_blanking(),
|
||||
m_useCOS(true),
|
||||
m_cosInvert(false),
|
||||
m_rfAudioBoost(1U),
|
||||
m_extAudioBoost(1U),
|
||||
m_downsampler(128U), //Size might need adjustement
|
||||
m_extEnabled(false)
|
||||
m_extEnabled(false),
|
||||
m_rxLevel(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +65,8 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
|||
|
||||
uint8_t i = 0U;
|
||||
for (; i < length; i++) {
|
||||
q15_t currentSample = samples[i];//save to a local variable to avoid indirection on every access
|
||||
// ARMv7-M has hardware integer division
|
||||
q15_t currentSample = q15_t((q31_t(samples[i]) << 8) / m_rxLevel);
|
||||
|
||||
uint8_t ctcssState = m_ctcssRX.process(currentSample);
|
||||
|
||||
|
|
@ -97,8 +97,6 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
|||
|
||||
// Only let RF audio through when relaying RF audio
|
||||
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF) {
|
||||
// currentSample = m_deemphasis.filter(currentSample);
|
||||
|
||||
if (m_extEnabled)
|
||||
m_downsampler.addSample(currentSample);
|
||||
|
||||
|
|
@ -130,8 +128,6 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
|||
|
||||
currentSample = m_filterStage3.filter(m_filterStage2.filter(m_filterStage1.filter(currentSample)));
|
||||
|
||||
// currentSample = m_preemphasis.filter(currentSample);
|
||||
|
||||
currentSample += m_ctcssTX.getAudio();
|
||||
|
||||
samples[i] = currentSample;
|
||||
|
|
@ -205,7 +201,9 @@ uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFreque
|
|||
m_timeoutTone.setParams(timeoutLevel);
|
||||
m_blanking.setParams(maxDev, timeoutLevel);
|
||||
|
||||
uint8_t ret = m_ctcssRX.setParams(ctcssFrequency, ctcssThreshold, rxLevel);
|
||||
m_rxLevel = rxLevel; //q15_t(255)/q15_t(rxLevel >> 1);
|
||||
|
||||
uint8_t ret = m_ctcssRX.setParams(ctcssFrequency, ctcssThreshold);
|
||||
if (ret != 0U)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue