From 44f82cec946c7a68878520be92efab5952e94256 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Mon, 18 Nov 2024 21:29:05 -0500 Subject: [PATCH] Things started working. --- csdr/chain/toolbox.py | 4 ++-- htdocs/lib/MessagePanel.js | 22 ++++++++++++++-------- owrx/toolbox.py | 11 ++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/csdr/chain/toolbox.py b/csdr/chain/toolbox.py index f45ef064..01dd1fd5 100644 --- a/csdr/chain/toolbox.py +++ b/csdr/chain/toolbox.py @@ -224,9 +224,9 @@ class RdsDemodulator(ServiceDemodulator, DialFrequencyReceiver): class CwSkimmerDemodulator(ServiceDemodulator, DialFrequencyReceiver): - def __init__(self, sampleRate: int = 12000, charCount: int = 8): + def __init__(self, sampleRate: int = 12000, charTotal: int = 64, charCount: int = 1): self.sampleRate = sampleRate - self.parser = CwSkimmerParser() + self.parser = CwSkimmerParser(charTotal) workers = [ Convert(Format.FLOAT, Format.SHORT), CwSkimmerModule(sampleRate, charCount), diff --git a/htdocs/lib/MessagePanel.js b/htdocs/lib/MessagePanel.js index b46724af..1f8144ff 100644 --- a/htdocs/lib/MessagePanel.js +++ b/htdocs/lib/MessagePanel.js @@ -893,7 +893,7 @@ CwSkimmerMessagePanel.prototype.supportsMessage = function(message) { CwSkimmerMessagePanel.prototype.render = function() { $(this.el).append($( - '' + + '
' + '' + '' + '' + @@ -904,27 +904,33 @@ CwSkimmerMessagePanel.prototype.render = function() { }; CwSkimmerMessagePanel.prototype.pushMessage = function(msg) { + // Must have some text + if (!msg.text) return; + // Find existing frequency var j = this.freqs.indexOf(msg.freq); - if (j >= 0) { // Update existing entry - this.texts[j] = msg.text; + this.texts[j] = (this.texts[j] + msg.text).slice(-64); } else { // Add a new entry this.freqs.push(msg.freq); this.texts.push(msg.text); // Limit the number of active frequencies - if (this.freqs.length > 10) { - this.freqs.pop(); - this.texts.pop(); - } +// if (this.freqs.length > 16) { +// this.freqs.shift(); +// this.texts.shift(); +// } } // Generate table body var body = ''; for (j = 0 ; j < this.freqs.length ; j++) { - body += '\n'; + body += + '\n'; } // Assign new table body diff --git a/owrx/toolbox.py b/owrx/toolbox.py index edcb757f..dc49954b 100644 --- a/owrx/toolbox.py +++ b/owrx/toolbox.py @@ -417,10 +417,9 @@ class EasParser(TextParser): class CwSkimmerParser(TextParser): - def __init__(self, charTotal: int = 32, service: bool = False): - self.reLine = re.compile("^(\d+):\s*(.*)$") + def __init__(self, charTotal: int = 64, service: bool = False): + self.reLine = re.compile("^(\d+):(.+)$") self.charTotal = charTotal - self.cwCache = {} # Construct parent object super().__init__(filePrefix="CW", service=service) @@ -434,12 +433,6 @@ class CwSkimmerParser(TextParser): if r is not None: freq = int(r.group(1)) text = r.group(2) - # Add up newly decoded characters - if freq in self.cwCache: - text = self.cwCache[freq] + text - # Truncate received text to charTotal - text = text if len(text) <= self.charTotal else text[:self.charTotal] - self.cwCache[freq] = text # Compose output out = { "mode": "CW", "text": text } # Add frequency, if known
FreqMessage
' + this.freqs[j] + '' + this.texts[j] + '
' + Math.round(this.freqs[j]/10)/100 + + '' + + this.texts[j] + '