Merged master 8748

This commit is contained in:
Jordan Sherer
2018-08-05 11:33:30 -04:00
parent 8f8772f1bd
commit 62899069bf
1222 changed files with 70382 additions and 406763 deletions
@@ -1,63 +0,0 @@
subroutine demod64a(s3,nadd,afac1,mrsym,mrprob,mr2sym,mr2prob,ntest,nlow)
! Demodulate the 64-bin spectra for each of 63 symbols in a frame.
! Parameters
! nadd number of spectra already summed
! mrsym most reliable symbol value
! mr2sym second most likely symbol value
! mrprob probability that mrsym was the transmitted value
! mr2prob probability that mr2sym was the transmitted value
implicit real*8 (a-h,o-z)
real*4 s3(64,63),afac1
real*8 fs(64)
integer mrsym(63),mrprob(63),mr2sym(63),mr2prob(63)
if(nadd.eq.-999) return
afac=afac1 * float(nadd)**0.64
scale=255.999
! Compute average spectral value
ave=sum(s3)/(64.*63.)
i1=1 !Silence warning
i2=1
! Compute probabilities for most reliable symbol values
do j=1,63
s1=-1.e30
psum=0.
do i=1,64
x=min(afac*s3(i,j)/ave,50.d0)
fs(i)=exp(x)
psum=psum+s3(i,j)
if(s3(i,j).gt.s1) then
s1=s3(i,j)
i1=i !Most reliable
endif
enddo
if(psum.eq.0.0) psum=1.e-6
s2=-1.e30
do i=1,64
if(i.ne.i1 .and. s3(i,j).gt.s2) then
s2=s3(i,j)
i2=i !Second most reliable
endif
enddo
p1=s1/psum !Symbol metrics for ftrsd
p2=s2/psum
mrsym(j)=i1-1
mr2sym(j)=i2-1
mrprob(j)=scale*p1
mr2prob(j)=scale*p2
enddo
nlow=0
do j=1,63
if(mrprob(j).le.5) nlow=nlow+1
enddo
ntest=sum(mrprob)
return
end subroutine demod64a
@@ -1,239 +0,0 @@
#include "displaytext.h"
#include <QMouseEvent>
#include <QDateTime>
#include <QTextCharFormat>
#include <QTextCursor>
#include <QTextBlock>
#include <QMenu>
#include <QAction>
#include "qt_helpers.hpp"
#include "moc_displaytext.cpp"
DisplayText::DisplayText(QWidget *parent)
: QTextEdit(parent)
, erase_action_ {new QAction {tr ("&Erase"), this}}
{
setReadOnly (true);
viewport ()->setCursor (Qt::ArrowCursor);
setWordWrapMode (QTextOption::NoWrap);
// max lines to limit heap usage
document ()->setMaximumBlockCount (5000);
// context menu erase action
setContextMenuPolicy (Qt::CustomContextMenu);
connect (this, &DisplayText::customContextMenuRequested, [this] (QPoint const& position) {
auto * menu = createStandardContextMenu (position);
menu->addAction (erase_action_);
menu->exec (mapToGlobal (position));
delete menu;
});
connect (erase_action_, &QAction::triggered, this, &DisplayText::erase);
}
void DisplayText::erase ()
{
clear ();
Q_EMIT erased ();
}
void DisplayText::setContentFont(QFont const& font)
{
char_font_ = font;
selectAll ();
auto cursor = textCursor ();
cursor.beginEditBlock ();
auto char_format = cursor.charFormat ();
char_format.setFont (char_font_);
cursor.mergeCharFormat (char_format);
cursor.clearSelection ();
cursor.movePosition (QTextCursor::End);
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::Up);
cursor.movePosition (QTextCursor::StartOfLine);
cursor.endEditBlock ();
setTextCursor (cursor);
ensureCursorVisible ();
}
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
{
Q_EMIT selectCallsign(e->modifiers ());
QTextEdit::mouseDoubleClickEvent(e);
}
void DisplayText::insertLineSpacer(QString const& line)
{
appendText (line, "#d3d3d3");
}
void DisplayText::appendText(QString const& text, QColor bg)
{
auto cursor = textCursor ();
cursor.movePosition (QTextCursor::End);
auto block_format = cursor.blockFormat ();
block_format.setBackground (bg);
if (0 == cursor.position ())
{
cursor.setBlockFormat (block_format);
auto char_format = cursor.charFormat ();
char_format.setFont (char_font_);
cursor.setCharFormat (char_format);
}
else
{
cursor.insertBlock (block_format);
}
cursor.insertText (text);
// position so viewport scrolled to left
cursor.movePosition (QTextCursor::StartOfLine);
setTextCursor (cursor);
ensureCursorVisible ();
document ()->setMaximumBlockCount (document ()->maximumBlockCount ());
}
QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg,
LogBook const& logBook, QColor color_CQ,
QColor color_DXCC,
QColor color_NewCall)
{
// allow for seconds
int padding {message.indexOf (" ") > 4 ? 2 : 0};
QString call = callsign;
QString countryName;
bool callWorkedBefore;
bool countryWorkedBefore;
if(call.length()==2) {
int i0=message.indexOf("CQ "+call);
call=message.mid(i0+6,-1);
i0=call.indexOf(" ");
call=call.mid(0,i0);
}
if(call.length()<3) return message;
if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message;
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
message = message.trimmed ();
QString appendage;
if (!countryWorkedBefore) // therefore not worked call either
{
appendage += "!";
*bg = color_DXCC;
}
else
{
if (!callWorkedBefore) // but have worked the country
{
appendage += "~";
*bg = color_NewCall;
}
else
{
appendage += " "; // have worked this call before
*bg = color_CQ;
}
}
// do some obvious abbreviations
countryName.replace ("Islands", "Is.");
countryName.replace ("Island", "Is.");
countryName.replace ("North ", "N. ");
countryName.replace ("Northern ", "N. ");
countryName.replace ("South ", "S. ");
countryName.replace ("East ", "E. ");
countryName.replace ("Eastern ", "E. ");
countryName.replace ("West ", "W. ");
countryName.replace ("Western ", "W. ");
countryName.replace ("Central ", "C. ");
countryName.replace (" and ", " & ");
countryName.replace ("Republic", "Rep.");
countryName.replace ("United States", "U.S.A.");
countryName.replace ("Fed. Rep. of ", "");
countryName.replace ("French ", "Fr.");
countryName.replace ("Asiatic", "AS");
countryName.replace ("European", "EU");
countryName.replace ("African", "AF");
appendage += countryName;
// use a nbsp to save the start of appended text so we can find
// it again later, align appended data at a fixed column if
// there is space otherwise let it float to the right
int space_count {40 + padding - message.size ()};
if (space_count > 0)
{
message += QString {space_count, QChar {' '}};
}
message += QChar::Nbsp + appendage;
return message;
}
void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
bool displayDXCCEntity, LogBook const& logBook,
QColor color_CQ, QColor color_MyCall,
QColor color_DXCC, QColor color_NewCall)
{
QColor bg {Qt::white};
bool CQcall = false;
if (decodedText.string ().contains (" CQ ")
|| decodedText.string ().contains (" CQDX ")
|| decodedText.string ().contains (" QRZ "))
{
CQcall = true;
bg = color_CQ;
}
if (myCall != "" and (
decodedText.indexOf (" " + myCall + " ") >= 0
or decodedText.indexOf (" " + myCall + "/") >= 0
or decodedText.indexOf ("/" + myCall + " ") >= 0
or decodedText.indexOf ("<" + myCall + " ") >= 0
or decodedText.indexOf (" " + myCall + ">") >= 0)) {
bg = color_MyCall;
}
auto message = decodedText.string ();
message = message.left (message.indexOf (QChar::Nbsp)); // strip appended info
if (displayDXCCEntity && CQcall)
// if enabled add the DXCC entity and B4 status to the end of the
// preformated text line t1
message = appendDXCCWorkedB4 (message, decodedText.CQersCall (), &bg, logBook, color_CQ,
color_DXCC, color_NewCall);
appendText (message.trimmed (), bg);
}
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
QColor color_TxMsg, bool bFastMode)
{
QString t1=" @ ";
if(modeTx=="FT8") t1=" ~ ";
if(modeTx=="JT4") t1=" $ ";
if(modeTx=="JT65") t1=" # ";
if(modeTx=="MSK144") t1=" & ";
QString t2;
t2.sprintf("%4d",txFreq);
QString t;
if(bFastMode or modeTx=="FT8") {
t = QDateTime::currentDateTimeUtc().toString("hhmmss") + \
" Tx " + t2 + t1 + text;
} else {
t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
" Tx " + t2 + t1 + text;
}
appendText (t, color_TxMsg);
}
void DisplayText::displayQSY(QString text)
{
QString t = QDateTime::currentDateTimeUtc().toString("hhmmss") + " " + text;
appendText (t, "hotpink");
}
@@ -1,55 +0,0 @@
// Status=review
.Receiver Noise Level
- If it is not already highlighted in green, click the *Monitor*
button to start normal receive operation.
- Be sure your transceiver is set to *USB* (or *USB Data*) mode.
- Use the receiver gain controls and/or the computer's audio mixer
controls to set the background noise level (scale at lower left of
main window) to around 30 dB when no signals are present. It is
usually best to turn AGC off or reduce the RF gain control to minimize
AGC action.
.Bandwidth and Frequency Setting
- If your transceiver offers more than one bandwidth setting in USB
mode, it may be advantageous to choose the widest one possible, up to
about 5 kHz. This choice has the desirable effect of allowing the
*Wide Graph* (waterfall and 2D spectrum) to display the conventional
JT65 and JT9 sub-bands simultaneously on most HF bands. Further
details are provided in the <<TUTORIAL,Basic Operating Tutorial>>. A
wider displayed bandwidth may also be helpful at VHF and above, where
JT4, JT65, and QRA64 signals are found over much wider ranges of
frequencies.
- If you have only a standard SSB filter you wont be able to display
more than about 2.7 kHz bandwidth. Depending on the exact dial
frequency setting, on HF bands you can display the full sub-band
generally used for one mode (JT65 or JT9) and part of the sub-band for
the other mode.
- Of course, you might prefer to concentrate on one mode at a time,
setting your dial frequency to (say) 14.074 for FT8, 14.076 for JT65,
or 14.078 for JT9. Present conventions have the nominal JT9 dial
frequency 2 kHz higher than the JT65 dial frequency on most bands, and
the FT8 frequency 2 kHz lower.
.Transmitter Audio Level
* Click the *Tune* button on the main screen to switch the
radio into transmit mode and generate a steady audio tone.
* Listen to the generated audio tone using your radios *Monitor*
facility. The transmitted tone should be perfectly smooth, with no
clicks or glitches. Make sure that this is true even when you
simultaneously use the computer to do other tasks such as email, web
browsing, etc.
* Adjust the *Pwr" slider (at the right edge of the main window)
downward from its maximum until the RF output from your transmitter
falls slightly. This is generally a good level for audio drive.
* Toggle the *Tune* button once more or click *Halt Tx* to stop your
test transmission.