mirror of https://github.com/g4klx/MMDVM.git
Rescale one of the filters for the MMDVM sample rate.
This commit is contained in:
parent
c896cf823e
commit
746d915bf9
|
@ -122,6 +122,7 @@ bool CAX25Demodulator::process(const q15_t* samples, uint8_t length, CAX25Frame&
|
||||||
} else {
|
} else {
|
||||||
result = HDLC(NRZI(bit));
|
result = HDLC(NRZI(bit));
|
||||||
if (result) {
|
if (result) {
|
||||||
|
// Copy the frame data.
|
||||||
::memcpy(frame.m_data, m_frame.m_data, AX25_MAX_PACKET_LEN);
|
::memcpy(frame.m_data, m_frame.m_data, AX25_MAX_PACKET_LEN);
|
||||||
frame.m_length = frame.m_length;
|
frame.m_length = frame.m_length;
|
||||||
frame.m_fcs = m_frame.m_fcs;
|
frame.m_fcs = m_frame.m_fcs;
|
||||||
|
@ -187,8 +188,6 @@ bool CAX25Demodulator::PLL(bool input)
|
||||||
|
|
||||||
bool CAX25Demodulator::HDLC(bool b)
|
bool CAX25Demodulator::HDLC(bool b)
|
||||||
{
|
{
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
if (m_hdlcOnes == 5U) {
|
if (m_hdlcOnes == 5U) {
|
||||||
if (b) {
|
if (b) {
|
||||||
// flag byte
|
// flag byte
|
||||||
|
@ -197,7 +196,7 @@ bool CAX25Demodulator::HDLC(bool b)
|
||||||
// bit stuffing...
|
// bit stuffing...
|
||||||
m_hdlcFlag = false;
|
m_hdlcFlag = false;
|
||||||
m_hdlcOnes = 0U;
|
m_hdlcOnes = 0U;
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +210,11 @@ bool CAX25Demodulator::HDLC(bool b)
|
||||||
m_hdlcOnes = 0U;
|
m_hdlcOnes = 0U;
|
||||||
|
|
||||||
if (m_hdlcFlag) {
|
if (m_hdlcFlag) {
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
switch (m_hdlcBuffer) {
|
switch (m_hdlcBuffer) {
|
||||||
case 0x7E:
|
case 0x7E:
|
||||||
if (m_frame.m_length > 0U) {
|
if (m_frame.m_length > 2U) {
|
||||||
result = m_frame.checkCRC();
|
result = m_frame.checkCRC();
|
||||||
if (!result)
|
if (!result)
|
||||||
m_frame.m_length = 0U;
|
m_frame.m_length = 0U;
|
||||||
|
@ -262,6 +263,6 @@ bool CAX25Demodulator::HDLC(bool b)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
AX25RX.cpp
29
AX25RX.cpp
|
@ -60,7 +60,7 @@ float32_t dB3[] = {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generated with Scipy Filter, 152 coefficients, 1100-2300Hz bandpass,
|
* Generated with Scipy Filter, 152 coefficients, 1100-2300Hz bandpass,
|
||||||
* Hann window, starting and ending 0 value coefficients removed.
|
* Hann window.
|
||||||
*
|
*
|
||||||
* np.array(
|
* np.array(
|
||||||
* firwin2(152,
|
* firwin2(152,
|
||||||
|
@ -79,19 +79,22 @@ float32_t dB3[] = {
|
||||||
*/
|
*/
|
||||||
const uint32_t FILTER_LEN = 132U;
|
const uint32_t FILTER_LEN = 132U;
|
||||||
|
|
||||||
// XXX This is for the wrong sample rate
|
|
||||||
q15_t FILTER_COEFFS[] = {
|
q15_t FILTER_COEFFS[] = {
|
||||||
4, 0, -5, -10, -13, -12, -9, -4, -2, -4, -12, -26,
|
0, 5, 12, 18, 21, 19, 11, -2, -15,
|
||||||
-41, -52, -51, -35, -3, 39, 83, 117, 131, 118, 83, 36,
|
-25, -27, -21, -11, -3, -5, -19, -43, -69,
|
||||||
-6, -32, -30, -3, 36, 67, 66, 19, -74, -199, -323, -408,
|
-83, -73, -35, 27, 98, 155, 180, 163, 109,
|
||||||
-421, -344, -187, 17, 218, 364, 417, 369, 247, 106, 14, 26,
|
39, -20, -45, -26, 23, 74, 89, 39, -81,
|
||||||
166, 407, 676, 865, 866, 605, 68, -675, -1484, -2171, -2547, -2471,
|
-247, -407, -501, -480, -334, -92, 175, 388, 479,
|
||||||
-1895, -882, 394, 1692, 2747, 3337, 3337, 2747, 1692, 394, -882, -1895,
|
429, 275, 99, 5, 68, 298, 626, 913, 994,
|
||||||
-2471, -2547, -2171, -1484, -675, 68, 605, 866, 865, 676, 407, 166,
|
740, 115, -791, -1770, -2544, -2847, -2509, -1527, -76,
|
||||||
26, 14, 106, 247, 369, 417, 364, 218, 17, -187, -344, -421,
|
1518, 2875, 3653, 3653, 2875, 1518, -76, -1527, -2509,
|
||||||
-408, -323, -199, -74, 19, 66, 67, 36, -3, -30, -32, -6,
|
-2847, -2544, -1770, -791, 115, 740, 994, 913, 626,
|
||||||
36, 83, 118, 131, 117, 83, 39, -3, -35, -51, -52, -41,
|
298, 68, 5, 99, 275, 429, 479, 388, 175,
|
||||||
-26, -12, -4, -2, -4, -9, -12, -13, -10, -5, 0, 4};
|
-92, -334, -480, -501, -407, -247, -81, 39, 89,
|
||||||
|
74, 23, -26, -45, -20, 39, 109, 163, 180,
|
||||||
|
155, 98, 27, -35, -73, -83, -69, -43, -19,
|
||||||
|
-5, -3, -11, -21, -27, -25, -15, -2, 11,
|
||||||
|
19, 21, 18, 12, 5, 0};
|
||||||
|
|
||||||
CAX25RX::CAX25RX() :
|
CAX25RX::CAX25RX() :
|
||||||
m_filter(),
|
m_filter(),
|
||||||
|
|
Loading…
Reference in New Issue