1 /* 2 * Copyright (C) 2019 3 * Matthias P. Braendli (matthias.braendli@mpb.li) 4 * 5 * Copyright (C) 2017 6 * Albrecht Lohofener (albrechtloh@gmx.de) 7 * 8 * This file is based on SDR-J 9 * Copyright (C) 2010, 2011, 2012 10 * Jan van Katwijk (J.vanKatwijk@gmail.com) 11 * 12 * This file is part of the welle.io. 13 * Many of the ideas as implemented in welle.io are derived from 14 * other work, made available through the GNU general Public License. 15 * All copyrights of the original authors are recognized. 16 * 17 * welle.io is free software; you can redistribute it and/or modify 18 * it under the terms of the GNU General Public License as published by 19 * the Free Software Foundation; either version 2 of the License, or 20 * (at your option) any later version. 21 * 22 * welle.io is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * GNU General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public License 28 * along with welle.io; if not, write to the Free Software 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 * 31 */ 32 33 #pragma once 34 35 // see OFDMProcessor::processPRS() for more information about these methods 36 enum class FreqsyncMethod { GetMiddle = 0, CorrelatePRS = 1, PatternOfZeros = 2 }; 37 38 enum class FFTPlacementMethod { 39 /* Old method: places the FFT on the strongest peak, which must be at least 40 * 3 times as high as the average. 41 * 42 * Issues: can lock on a peak that is not the earlisest peak (multipath) 43 */ 44 StrongestPeak, 45 46 /* Calculate peaks over bins of 25 samples, keep the 4 bins with the 47 * highest peaks, take the index from the peak in the earliest bin, but not 48 * any earlier than 500 samples. 49 * 50 * Issues: sometimes loses lock even in good receive conditions. 51 */ 52 EarliestPeakWithBinning, 53 54 /* Apply a windowing function that selects the peak correlation, then 55 * place the FFT where the correlation goes above a threshold earliest. 56 * 57 * Issues: performance not yet assessed. 58 */ 59 ThresholdBeforePeak, 60 }; 61 62 // Default uses the old algorithm until the issues of the new one are solved. 63 constexpr auto DEFAULT_FFT_PLACEMENT = FFTPlacementMethod::ThresholdBeforePeak; 64 65 // Configuration for the backend 66 struct RadioReceiverOptions { 67 // Select the algorithm used in the OFDMProcessor PRS sync logic 68 // to place the FFT window for demodulation. 69 // 70 // Issues: initial lock can take longer than with original algorithm. 71 FFTPlacementMethod fftPlacementMethod = DEFAULT_FFT_PLACEMENT; 72 73 // Set to true to enable the TII decoder. Default is false because it is 74 // consumes CPU resources. 75 bool decodeTII = false; 76 77 // Good receivers with accurate clocks do not need the coarse corrector. 78 // Disabling it can accelerate lock. 79 bool disableCoarseCorrector = false; 80 81 // Which method to use for the freqsyncmethod used in the coarse corrector. 82 // Has no effect when coarse corrector is disabled. 83 FreqsyncMethod freqsyncMethod = FreqsyncMethod::PatternOfZeros; 84 }; 85 86