diff --git a/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.cpp b/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.cpp index de1245850..86d51a77c 100644 --- a/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.cpp +++ b/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.cpp @@ -90,12 +90,7 @@ MeshtasticDemodSink::MeshtasticDemodSink() : m_minRequiredPreambleChirps, std::min(ctorTargetRequired, m_maxRequiredPreambleChirps) ); - m_fftInterpolation = (m_settings.m_codingScheme == MeshtasticDemodSettings::CodingLoRa) - ? m_loRaFFTInterpolation - : m_legacyFFTInterpolation; - - m_chirp = 0; - m_chirp0 = 0; + m_fftInterpolation = m_loRaFFTInterpolation; initSF(m_settings.m_spreadFactor, m_settings.m_deBits); } @@ -138,12 +133,9 @@ void MeshtasticDemodSink::initSF(unsigned int sf, unsigned int deBits) m_nbSymbols = 1 << sf; m_nbSymbolsEff = 1 << (sf - deBits); - m_deLength = 1 << deBits; m_fftLength = m_nbSymbols; m_interpolatedFFTLength = m_fftInterpolation*m_fftLength; - m_preambleTolerance = std::max(1, (m_deLength*static_cast(m_fftInterpolation))/2); m_fftSequence = fftFactory->getEngine(m_interpolatedFFTLength, false, &m_fft); - m_sfdSkip = m_fftLength / 4; m_downChirps = new Complex[2*m_nbSymbols]; // Each table is 2 chirps long to allow processing from arbitrary offsets. m_upChirps = new Complex[2*m_nbSymbols]; m_spectrumBuffer = new Complex[m_nbSymbols]; @@ -223,15 +215,6 @@ void MeshtasticDemodSink::feed(const SampleVector::const_iterator& begin, const void MeshtasticDemodSink::reset() { resetLoRaFrameSync(); - m_chirp = 0; - m_chirp0 = 0; - m_fftCounter = 0; - m_preambleConsecutive = 0; - m_havePrevPreambleBin = false; - m_prevPreambleBin = 0; - m_preambleBinHistory.clear(); - m_sfdSkipCounter = 0; - m_syncWord = 0; m_headerLocked = false; m_expectedSymbols = 0; m_waitHeaderFeedback = false; @@ -532,7 +515,6 @@ void MeshtasticDemodSink::resetLoRaFrameSync() m_expectedSymbols = 0; m_waitHeaderFeedback = false; m_headerFeedbackWaitSteps = 0; - m_syncWord = 0; if (!m_loRaPreambleVals.empty()) { std::fill(m_loRaPreambleVals.begin(), m_loRaPreambleVals.end(), 0); @@ -1251,9 +1233,7 @@ void MeshtasticDemodSink::applySettings(const MeshtasticDemodSettings& settings, << " m_title: " << settings.m_title << " force: " << force; - const unsigned int desiredFFTInterpolation = (settings.m_codingScheme == MeshtasticDemodSettings::CodingLoRa) - ? m_loRaFFTInterpolation - : m_legacyFFTInterpolation; + const unsigned int desiredFFTInterpolation = m_loRaFFTInterpolation; const bool fftInterpChanged = desiredFFTInterpolation != m_fftInterpolation; if ((settings.m_spreadFactor != m_settings.m_spreadFactor) diff --git a/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.h b/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.h index 47186e758..5b6a6f60a 100644 --- a/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.h +++ b/plugins/channelrx/demodmeshtastic/meshtasticdemodsink.h @@ -91,13 +91,9 @@ private: int m_channelSampleRate; int m_channelFrequencyOffset; qint64 m_deviceCenterFrequency; - unsigned int m_chirp; - unsigned int m_chirp0; static constexpr unsigned int m_minRequiredPreambleChirps = 4; //!< Lower bound for preamble validation chirps static constexpr unsigned int m_maxRequiredPreambleChirps = 64; //!< Upper bound for preamble validation chirps - static constexpr unsigned int m_maxSFDSearchChirps = 64; //!< Maximum number of chirps when looking for SFD after preamble detection - static constexpr unsigned int m_legacyFFTInterpolation = 4; //!< Legacy interpolation for non-LoRa modes static constexpr unsigned int m_loRaFFTInterpolation = 1; //!< Canonical gr-lora_sdr-like FFT binning for LoRa FFTEngine *m_fft; @@ -105,22 +101,12 @@ private: Complex *m_downChirps; Complex *m_upChirps; Complex *m_spectrumLine; - unsigned int m_fftCounter; - std::deque m_preambleBinHistory; //!< Rolling preamble bins for mode (k_hat) estimation - unsigned int m_preambleConsecutive; //!< Consecutive upchirp count in DETECT state - bool m_havePrevPreambleBin; - unsigned int m_prevPreambleBin; unsigned int m_requiredPreambleChirps; - unsigned int m_preambleHistory[m_maxSFDSearchChirps]; - unsigned int m_syncWord; double m_magsqMax; MovingAverageUtil m_magsqOnAvg; MovingAverageUtil m_magsqOffAvg; MovingAverageUtil m_magsqTotalAvg; std::queue m_magsqQueue; - unsigned int m_chirpCount; //!< Generic chirp counter - unsigned int m_sfdSkip; //!< Number of samples in a SFD skip or slide (1/4) period - unsigned int m_sfdSkipCounter; //!< Counter of skip or slide periods bool m_headerLocked; //!< True when header decode succeeded and we have a deterministic symbol budget unsigned int m_expectedSymbols; //!< Total expected symbols (header + payload) from header decode @@ -180,8 +166,6 @@ private: unsigned int m_fftLength; //!< Length of base FFT unsigned int m_fftInterpolation; //!< FFT interpolation factor (LoRa=1, legacy modes=4) unsigned int m_interpolatedFFTLength; //!< Length of interpolated FFT - int m_deLength; //!< Number of FFT bins collated to represent one symbol - int m_preambleTolerance; //!< Number of FFT bins to collate when looking for preamble void initSF(unsigned int sf, unsigned int deBits); //!< Init tables, FFTs, depending on spread factor void reset();