Added option to switch between US and EU RDS decoding.

This commit is contained in:
Marat Fayzullin 2023-12-09 19:41:10 -05:00
parent d099dd92d3
commit 32c42a8c33
4 changed files with 17 additions and 5 deletions

View File

@ -4,6 +4,7 @@ from pycsdr.modules import FmDemod, AudioResampler, Convert, Agc, Squelch
from pycsdr.types import Format
from owrx.toolbox import TextParser, PageParser, SelCallParser, IsmParser, RdsParser
from owrx.aircraft import HfdlParser, Vdl2Parser, AdsbParser, AcarsParser
from owrx.config import Config
import os
@ -192,11 +193,13 @@ class AcarsDemodulator(ServiceDemodulator, DialFrequencyReceiver):
class RdsDemodulator(ServiceDemodulator, DialFrequencyReceiver):
def __init__(self):
pm = Config.get()
self.usa = pm["rds_usa"]
self.sampleRate = 171000
self.parser = RdsParser()
workers = [
Convert(Format.FLOAT, Format.SHORT),
RedseaModule(self.sampleRate),
RedseaModule(self.sampleRate, usa=self.usa),
self.parser,
]
# Connect all the workers

View File

@ -151,15 +151,19 @@ class AcarsDecModule(WavFileModule):
class RedseaModule(WavFileModule):
def __init__(self, sampleRate: int = 171000):
def __init__(self, sampleRate: int = 171000, usa: bool = False):
self.sampleRate = sampleRate
self.usa = usa
super().__init__()
def getCommand(self):
return [
cmd = [
"redsea", "--file", "/dev/stdin", "--input", "mpx",
"--samplerate", str(self.sampleRate), "--rbds"
"--samplerate", str(self.sampleRate)
]
if self.usa:
cmd += ["--rbds"]
return cmd
def getOutputFormat(self) -> Format:
return Format.CHAR

View File

@ -207,5 +207,6 @@ defaultConfig = PropertyLayer(
acars_ttl=1800,
fax_postprocess=True,
fax_color=False,
fax_am=False
fax_am=False,
rds_usa=False
).readonly()

View File

@ -33,6 +33,10 @@ class DecodingSettingsController(SettingsFormController):
infotext='See <a href="https://en.wikipedia.org/wiki/FM_broadcasting#Pre-emphasis_and_de-emphasis"'
+ ' target="_blank">this Wikipedia article</a> for more information',
),
CheckboxInput(
"rds_usa",
"Decode USA-specific RDS information from WFM broadcasts",
),
),
Section(
"Digital voice",