mirror of https://github.com/g4klx/MMDVM.git
Trying to fix no tx, WIP
This commit is contained in:
parent
b4a125a759
commit
042c26b3bb
51
FM.cpp
51
FM.cpp
|
@ -62,7 +62,7 @@ m_inputExtRB(2400U) // 100ms of Audio
|
||||||
insertDelay(100U);
|
insertDelay(100U);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
|
void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
||||||
{
|
{
|
||||||
if (m_useCOS) {
|
if (m_useCOS) {
|
||||||
if (m_cosInvert)
|
if (m_cosInvert)
|
||||||
|
@ -147,35 +147,37 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
|
||||||
currentSample += m_ctcssTX.getAudio();
|
currentSample += m_ctcssTX.getAudio();
|
||||||
|
|
||||||
m_outputRFRB.put(currentSample);
|
m_outputRFRB.put(currentSample);
|
||||||
|
//samples[i] = currentSample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX This relays audio correctly, no t, process need to be commented
|
||||||
|
// if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT)
|
||||||
|
// io.write(STATE_FM, samples, i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFM::process()
|
void CFM::process()
|
||||||
{
|
{
|
||||||
q15_t sample;
|
uint16_t space = io.getSpace() - 2U;
|
||||||
while (io.getSpace() >= 3U && m_outputRFRB.get(sample))
|
uint16_t length = m_outputRFRB.getData();
|
||||||
io.write(STATE_FM, &sample, 1U);
|
if (space > 2 && length >= FM_TX_BLOCK_SIZE ) {
|
||||||
|
|
||||||
// if (io.getSpace() > 2 && (m_outputRFRB.getData() >= FM_TX_BLOCK_SIZE || m_state != STATE_FM)) {//if we just left FM mode, so write all what is left in buffer, regardless of the amoutn of data
|
if(length > FM_TX_BLOCK_SIZE)
|
||||||
// uint16_t length = m_outputRFRB.getData();
|
length = FM_TX_BLOCK_SIZE;
|
||||||
// uint16_t space = io.getSpace() - 2;
|
if(space > FM_TX_BLOCK_SIZE)
|
||||||
|
space = FM_TX_BLOCK_SIZE;
|
||||||
|
if(length > space)
|
||||||
|
length = space;
|
||||||
|
|
||||||
// if(length > FM_TX_BLOCK_SIZE)
|
q15_t samples[FM_TX_BLOCK_SIZE];
|
||||||
// length = FM_TX_BLOCK_SIZE;
|
for(uint16_t i = 0U; i < length; i++) {
|
||||||
// if(space > FM_TX_BLOCK_SIZE)
|
q15_t sample = 0;
|
||||||
// space = FM_TX_BLOCK_SIZE;
|
m_outputRFRB.get(sample);
|
||||||
// if(length > space)
|
samples[i] = sample;
|
||||||
// length = space;
|
}
|
||||||
|
|
||||||
// q15_t samples[FM_TX_BLOCK_SIZE];
|
io.write(STATE_FM, samples, length);
|
||||||
// for(uint16_t i = 0; i < length; i++) {
|
}
|
||||||
// q15_t sample = 0;
|
|
||||||
// m_outputRFRB.get(sample);
|
|
||||||
// samples[i] = sample;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// io.write(STATE_FM, samples, length);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Write audio to serial
|
// //Write audio to serial
|
||||||
// if (m_downsampler.getData() >= 127 || m_state != STATE_FM) {//if we just left FM mode, so write all what is left in buffer, regardless of the amoutn of data
|
// if (m_downsampler.getData() >= 127 || m_state != STATE_FM) {//if we just left FM mode, so write all what is left in buffer, regardless of the amoutn of data
|
||||||
|
@ -325,6 +327,11 @@ void CFM::stateMachine(bool validRFSignal, bool validExtSignal)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_state == FS_LISTENING) {
|
||||||
|
m_outputRFRB.reset();
|
||||||
|
m_downsampler.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFM::clock(uint8_t length)
|
void CFM::clock(uint8_t length)
|
||||||
|
|
3
FM.h
3
FM.h
|
@ -51,7 +51,7 @@ class CFM {
|
||||||
public:
|
public:
|
||||||
CFM();
|
CFM();
|
||||||
|
|
||||||
void samples(bool cos, const q15_t* samples, uint8_t length);
|
void samples(bool cos, q15_t* samples, uint8_t length);
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ private:
|
||||||
void clock(uint8_t length);
|
void clock(uint8_t length);
|
||||||
|
|
||||||
void sendCallsign();
|
void sendCallsign();
|
||||||
|
void sendBeeps();
|
||||||
void beginRelaying();
|
void beginRelaying();
|
||||||
|
|
||||||
void insertDelay(uint16_t ms);
|
void insertDelay(uint16_t ms);
|
||||||
|
|
Loading…
Reference in New Issue