diff --git a/DMRSlotRX.cpp b/DMRSlotRX.cpp index d312266..157280b 100644 --- a/DMRSlotRX.cpp +++ b/DMRSlotRX.cpp @@ -24,6 +24,14 @@ #include "DMRSlotType.h" #include "Utils.h" +#if defined(ARDUINO_DUE_ZUM_V10) || defined(ARDUINO_DUE_NTH) +const uint16_t SCAN_START = 420U; +const uint16_t SCAN_END = 510U; +#else +const uint16_t SCAN_START = 400U; +const uint16_t SCAN_END = 490U; +#endif + const q15_t SCALING_FACTOR = 19505; // Q15(0.60) const uint8_t MAX_SYNC_SYMBOLS_ERRS = 2U; @@ -115,7 +123,7 @@ bool CDMRSlotRX::processSample(q15_t sample) m_bitBuffer[m_bitPtr] |= 0x01U; if (m_state == DMRRXS_NONE) { - if (m_dataPtr >= 400U && m_dataPtr <= 490U) + if (m_dataPtr >= SCAN_START && m_dataPtr <= SCAN_END) correlateSync(true); } else { uint16_t min = m_syncPtr - 1U; diff --git a/IO.cpp b/IO.cpp index 3540f10..01adede 100644 --- a/IO.cpp +++ b/IO.cpp @@ -24,11 +24,20 @@ #include "Globals.h" #include "IO.h" +#if defined(ARDUINO_DUE_ZUM_V10) || defined(ARDUINO_DUE_NTH) +// Generated using rcosdesign(0.2, 6, 5, 'sqrt') plus a custom filter in MATLAB +static q15_t C4FSK_FILTER[] = {1, 2, 1, -5, -17, -28, -17, 37, 121, 175, 105, -137, -475, -690, -518, 166, 1197, 2114, 2346, 1516, -309, + -2550, -4280, -4565, -2827, 885, 5849, 10850, 14549, 15911, 14549, 10850, 5849, 885, -2827, -4565, -4280. + -2550, -309, 1516, 2346, 2114, 1197, 166, -518, -690, -475, -137, 105, 175, 121, 37, -17, -28, -17, -5, 1, + 2, 1, 0}; +const uint16_t C4FSK_FILTER_LEN = 60U; +#else // Generated using rcosdesign(0.2, 8, 5, 'sqrt') in MATLAB static q15_t C4FSK_FILTER[] = {401, 104, -340, -731, -847, -553, 112, 909, 1472, 1450, 683, -675, -2144, -3040, -2706, -770, 2667, 6995, 11237, 14331, 15464, 14331, 11237, 6995, 2667, -770, -2706, -3040, -2144, -675, 683, 1450, 1472, 909, 112, -553, -847, -731, -340, 104, 401, 0}; const uint16_t C4FSK_FILTER_LEN = 42U; +#endif // Generated using gaussfir(0.5, 4, 5) in MATLAB static q15_t GMSK_FILTER[] = {8, 104, 760, 3158, 7421, 9866, 7421, 3158, 760, 104, 8, 0};