diff --git a/csdr/__init__.py b/csdr/__init__.py index 3bf5a7b..856cea2 100644 --- a/csdr/__init__.py +++ b/csdr/__init__.py @@ -671,6 +671,8 @@ class Dsp(DirewolfConfigSubscriber): def set_dmr_filter(self, filter): if self.has_pipe("dmr_control_pipe"): self.pipes["dmr_control_pipe"].write("{0}\n".format(filter)) + if self.pycsdr_enabled and self.pycsdr_chain is not None and isinstance(self.pycsdr_chain, DemodulatorChain): + self.pycsdr_chain.setDmrFilter(filter) def set_wfm_deemphasis_tau(self, tau): if self.wfm_deemphasis_tau == tau: diff --git a/csdr/chain/demodulator.py b/csdr/chain/demodulator.py index 88ac813..8971c79 100644 --- a/csdr/chain/demodulator.py +++ b/csdr/chain/demodulator.py @@ -1,6 +1,7 @@ from csdr.chain import Chain from pycsdr.modules import Shift, FirDecimate, Bandpass, Squelch, FractionalDecimator, Writer from pycsdr.types import Format +from csdr.chain.digiham import Dmr class DemodulatorChain(Chain): @@ -49,6 +50,10 @@ class DemodulatorChain(Chain): def setMetaWriter(self, writer: Writer): self.demodulator.setMetaWriter(writer) + def setDmrFilter(self, filter: int) -> None: + if isinstance(self.demodulator, Dmr): + self.demodulator.setSlotFilter(filter) + def _getDecimation(self, input_rate, output_rate): if output_rate <= 0: raise ValueError("invalid output rate: {rate}".format(rate=output_rate)) diff --git a/csdr/chain/digiham.py b/csdr/chain/digiham.py index 2da10c4..c31fc59 100644 --- a/csdr/chain/digiham.py +++ b/csdr/chain/digiham.py @@ -42,9 +42,13 @@ class Nxdn(DigihamChain): self.mbeMode = Modes.NxdnMode super().__init__(codecserver) + class Dmr(DigihamChain): def __init__(self, codecserver: str = ""): self.fskDemodulator = GfskDemodulator(samplesPerSymbol=10) self.decoder = DmrDecoder() self.mbeMode = Modes.DmrMode super().__init__(codecserver) + + def setSlotFilter(self, filter: int) -> None: + self.decoder.setSlotFilter(filter)