mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-04-07 15:45:39 -04:00
Morse decoder: set text intensity according to decoding cost factor
This commit is contained in:
parent
32837c7757
commit
fedade27dd
@ -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<int>(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));
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ Lock the pitch and speed to the current values detected by GGMorse. Unlock to re
|
||||
|
||||
<h3>11: Decoder cost factor</h3>
|
||||
|
||||
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.
|
||||
|
||||
<h3>11a: Show decoder threshold</h3>
|
||||
|
||||
@ -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}$
|
||||
|
||||
<h3>16. Waveforms view</h3>
|
||||
|
||||
This scope display shows waveforms related to the decoding with GGMorse.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user