mirror of https://github.com/g4klx/MMDVM.git
Temporary revert to previous code
This commit is contained in:
parent
86ffc69b30
commit
6786b9b6b1
70
FM.cpp
70
FM.cpp
|
@ -20,10 +20,8 @@
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "FM.h"
|
#include "FM.h"
|
||||||
|
|
||||||
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
const uint16_t FM_TX_BLOCK_SIZE = 250U;
|
||||||
|
const uint16_t FM_SERIAL_BLOCK_SIZE = 127U;
|
||||||
#define WRITE_BIT_AUDIO(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
|
||||||
#define READ_BIT_AUDIO(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
|
|
||||||
|
|
||||||
CFM::CFM() :
|
CFM::CFM() :
|
||||||
m_callsign(),
|
m_callsign(),
|
||||||
|
@ -154,39 +152,51 @@ void CFM::samples(bool cos, const q15_t* samples, uint8_t length)
|
||||||
|
|
||||||
void CFM::process()
|
void CFM::process()
|
||||||
{
|
{
|
||||||
if (io.getSpace() > 2 && (m_outputRFRB.getData() >= 250 || m_state != STATE_FM)) {//if we just left FM mode, so write all what is left in buffer, regardless of the amoutn of data
|
q15_t sample;
|
||||||
uint16_t length = m_outputRFRB.getData();
|
while (io.getSpace() >= 3U && m_outputRFRB.get(sample))
|
||||||
uint16_t space = io.getSpace() - 2;
|
io.write(STATE_FM, &sample, 1U);
|
||||||
|
|
||||||
if(length > space)
|
// 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
|
||||||
length = space;
|
// uint16_t length = m_outputRFRB.getData();
|
||||||
|
// uint16_t space = io.getSpace() - 2;
|
||||||
|
|
||||||
q15_t samples[length];
|
// if(length > FM_TX_BLOCK_SIZE)
|
||||||
for(uint16_t i = 0; i < length; i++) {
|
// length = FM_TX_BLOCK_SIZE;
|
||||||
q15_t sample = 0;
|
// if(space > FM_TX_BLOCK_SIZE)
|
||||||
m_outputRFRB.get(sample);
|
// space = FM_TX_BLOCK_SIZE;
|
||||||
samples[i] = sample;
|
// if(length > space)
|
||||||
}
|
// length = space;
|
||||||
|
|
||||||
io.write(STATE_FM, samples, length);
|
// q15_t samples[FM_TX_BLOCK_SIZE];
|
||||||
}
|
// for(uint16_t i = 0; i < length; i++) {
|
||||||
|
// q15_t sample = 0;
|
||||||
|
// m_outputRFRB.get(sample);
|
||||||
|
// samples[i] = sample;
|
||||||
|
// }
|
||||||
|
|
||||||
//Write audio to serial
|
// io.write(STATE_FM, samples, length);
|
||||||
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
|
// }
|
||||||
uint16_t length = m_downsampler.getData();
|
|
||||||
|
|
||||||
if(length > 127U)//max message size on serial is 127
|
// //Write audio to serial
|
||||||
length = 127U;
|
// 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
|
||||||
|
// uint16_t length = m_downsampler.getData();
|
||||||
|
|
||||||
uint8_t serialSamples[length];
|
// if(length > FM_SERIAL_BLOCK_SIZE)//max message size on serial is 127
|
||||||
|
// length = FM_SERIAL_BLOCK_SIZE;
|
||||||
|
|
||||||
for(uint16_t i = 0U; i < length; i++) {
|
// if(length > FM_SERIAL_BLOCK_SIZE)
|
||||||
uint8_t serialSample = 0U;
|
// length = FM_SERIAL_BLOCK_SIZE;
|
||||||
m_downsampler.getPackedData(serialSample);
|
|
||||||
serialSamples[i] = serialSample;
|
// uint8_t serialSamples[FM_SERIAL_BLOCK_SIZE];
|
||||||
}
|
|
||||||
serial.writeFMData(serialSamples, length);
|
// for(uint16_t i = 0U; i < length; i++) {
|
||||||
}
|
// uint8_t serialSample = 0U;
|
||||||
|
// m_downsampler.getPackedData(serialSample);
|
||||||
|
// serialSamples[i] = serialSample;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// serial.writeFMData(serialSamples, length);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFM::reset()
|
void CFM::reset()
|
||||||
|
|
Loading…
Reference in New Issue