From fedade27dd311362c8c165aa430d91bfbbd6d1ed Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 17 Jan 2026 05:52:08 +0100 Subject: [PATCH] Morse decoder: set text intensity according to decoding cost factor --- plugins/feature/morsedecoder/morsedecodergui.cpp | 12 ++++++++++-- plugins/feature/morsedecoder/morsedecodergui.h | 2 +- plugins/feature/morsedecoder/readme.md | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/feature/morsedecoder/morsedecodergui.cpp b/plugins/feature/morsedecoder/morsedecodergui.cpp index 2e315841f..cabc877c5 100644 --- a/plugins/feature/morsedecoder/morsedecodergui.cpp +++ b/plugins/feature/morsedecoder/morsedecodergui.cpp @@ -114,7 +114,7 @@ bool MorseDecoderGUI::handleMessage(const Message& message) else if (MorseDecoder::MsgReportText::match(message)) { MorseDecoder::MsgReportText& report = (MorseDecoder::MsgReportText&) message; - textReceived(report.getText()); + textReceived(report.getText(), report.m_costFunction); updateMorseStats(report.m_estimatedPitchHz, report.m_estimatedSpeedWPM, report.m_costFunction); } @@ -133,8 +133,15 @@ void MorseDecoderGUI::handleInputMessages() } } -void MorseDecoderGUI::textReceived(const QString& text) +void MorseDecoderGUI::textReceived(const QString& text, float cost) { + // Set text color based on cost + int light = static_cast(255.0f / (1 + 2*cost)); + + if (light < 25) { + return; // too faint to display + } + // Is the scroll bar at the bottom? int scrollPos = ui->text->verticalScrollBar()->value(); bool atBottom = scrollPos >= ui->text->verticalScrollBar()->maximum(); @@ -145,6 +152,7 @@ void MorseDecoderGUI::textReceived(const QString& text) // Restore scroll position ui->text->verticalScrollBar()->setValue(scrollPos); + ui->text->setTextColor(QColor(light, light, light)); // Format and insert text ui->text->insertPlainText(MorseDecoderSettings::formatText(text)); diff --git a/plugins/feature/morsedecoder/morsedecodergui.h b/plugins/feature/morsedecoder/morsedecodergui.h index 9da8e01d6..dee5e209d 100644 --- a/plugins/feature/morsedecoder/morsedecodergui.h +++ b/plugins/feature/morsedecoder/morsedecodergui.h @@ -80,7 +80,7 @@ private: void displaySampleRate(int sampleRate); void updateChannelList(); bool handleMessage(const Message& message); - void textReceived(const QString& text); + void textReceived(const QString& text, float cost = 0.0f); void updateMorseStats(float estPitch, float estWPM, float cost); void makeUIConnections(); diff --git a/plugins/feature/morsedecoder/readme.md b/plugins/feature/morsedecoder/readme.md index c3b097ba8..49f3c734b 100644 --- a/plugins/feature/morsedecoder/readme.md +++ b/plugins/feature/morsedecoder/readme.md @@ -65,7 +65,7 @@ Lock the pitch and speed to the current values detected by GGMorse. Unlock to re

11: Decoder cost factor

-This is the GGMorse decoder cost factor. Successful decodes yield from a few millis to a few tens of millis. +This is the GGMorse decoder cost factor. Most successful decodes yield from a few millis to a few tens of millis.

11a: Show decoder threshold

@@ -87,6 +87,10 @@ Push this button to clear the text in the text window (15) This area shows the decoded text. New text appears every 3 seconds which is the GGMorse analysis window length. +The intensity of the text is proportional to the cost of the decoding function displayed in (11) (the lower the more confident and the brighter) with the following formula on the 25..255 scale (if lower than 25 which is the background intensity it is not displayed): + +$f(cost) = \frac{255}{1+2cost}$ +

16. Waveforms view

This scope display shows waveforms related to the decoding with GGMorse.